I'm very new to AppleScript and I'm trying to do this. I have an Safari process running on my machine. I wish I could go to the running safari and stimulate an enter key event.
Is it possible to do so?
The code I'm trying is:
on is_running(appName) tell application "System Events" to (name of processes) contains appName end is_running set safRunning to is_running("Safari") if safRunning then run script "tell application \"Safari\" key code 36 end tell" return "Running" else return "Not running" end if
run script the
key code 36 (for stimulating enter) is giving me error:
error "Expected end of line but found identifier." number -2741
Any guesses where I'm making mistake?