I am looking for a script that would press "Q" every second when idle for a certain amount of time in an application. I have never coded before and have several issues with code (below) that'd I have no idea how to fix
Here is the code I've tried:
repeat 52 times
repeat 52 times
delay 0.5
tell application "Roblox"
set currentTab to do
script ("q") in front window
end tell
delay 0.5
end repeat
end repeat
It errors with:
error "The variable do is not defined." number -2753 from "do"
set currentTab to doandscript ("q") in front windowshould be on one line, e.g.set currentTab to do script ("q") in front window, however, that is an improper use of thedo scriptcommand! That said, there are hundreds of examples of how to use System Events and thekeystroke/key codecommand on the Internet, I know because I've writen more than a few of them. – user3439894 Nov 05 '20 at 19:16applescript sending keystrokesand do some reading. There are plenty of working examples out there! The top hit for that search string is: How do I automate a key press in AppleScript? – user3439894 Nov 05 '20 at 19:23