Thanks, I tried that but I don't know how to write the apple scripts. I gave it my best attempt with this:You could probably use Automator to create a script for what you want to do.
GUI() --do stuff with UI scripting -- Activate the application you'd like to target tell application "Torchlight" to activate tell application "System Events" -- Send your keystroke tell process "Torchlight" repeat keystroke "3" keystroke "2" keystroke "1" click end repeat end tell end tell on GUI() tell application "System Events" if UI elements enabled then else repeat until UI elements enabled is true beep tell application "System Preferences" activate set current pane to pane "com.apple.preference.universalaccess" end tell tell application "Finder" activate display dialog "UI element scripting is not enabled. Please check \"Enable access for assistive devices\" Then click \"ok\"" end tell end repeat end if end tell end GUI
Info : https://developer.apple.com/library/mac/#documentation/applescript/conceptual/applescriptlangguide/reference/ASLR_control_statements.html#//apple_ref/doc/uid/TP40000983-CH6g-127362repeat (forever)
Repeats a statement (or statements) until an exit statement is encountered.
Important: A repeat (forever) statement will never complete unless you cause it to do so.
To terminate a repeat (forever) statement, you can:
Use an exit statement and design the logic so that it eventually encounters the exit statement.
Use a “return” statement, which exits the handler or script that contains the loop, and therefore the loop as well.
Use a try statement and rely on an error condition to exit the loop.