Hello again! I’m trying to make an script that will press a certain key from time to time and allow you to move around the computer.
I already have the script done, but it requires that the application is active (frontmost)
on idle
tell application "System Events"
tell application "appname" to activate
keystroke "20"
delay 60
end tell
end idle
so what i want is for it to do this, but allow me to do what i want in the computer. Any ideas?
Model: Macbook
Browser: Safari 525.13
Operating System: Mac OS X (10.5)
the target process to send the keystroke to must be frontmost.
A possible workaround is to save the current frontmost application into a variable,
send the keystroke and reactivate the former application
tell application "System Events"
set frontProc to 1st process whose frontmost is true
tell process "appname"
set frontmost to true
keystroke 20
end tell
set frontmost of frontProc to true
end tell