I am trying to quit an application via Applescript. Even when I close the application by click the app’s red close button manually I get an error dialog. The app wants me to close it using keystrokes…
Is there a way to send keystrokes to an app with Applescript?
I am trying to close GLTron…here is what I’ve come up with, though it does not work:
–setup the down-arrow key
set myDown to ASCII character 31
if process "GLTron" exists then
try
tell application "GLTron"
activate
tell application "System Events"
keystroke esc
keystroke esc
keystroke myDown
keystroke myDown
keystroke myDown
keystroke space
keystroke space
end tell
end tell
end try
end if
Can anyone help with this?
Thank you!!