I am making a service in Automator that runs the following AppleScript code:
on run {input, parameters}
tell application "System Events"
click at {393, 77}
delay 0.1
keystroke "Hello"
delay 0.1
keystroke return
end tell
return input
end run
If you couldn't tell, I'm trying to click on something and type "Hello" there. However, when I run this, all that happens is I hear the "plunk" sound when you do something invalid, twice. Why isn't this code working?
The log does say "Run AppleScript completed" and then "Workflow completed."
I have it set to run with no input on any application.
I tried increasing the delays, but that didn't help.
Let me know if there's any more details I can provide.
Best Answer
I would suggest downloading AppleScript toolbox scripting addition. Once installed in the proper locations, in Script Editor.app, , you will be able to use commands from the key and mouse suite from the AppleScript toolbox dictionary to…get, set, and click at mouse locations (coordinates)
Here is some sample code using commands from the AppleScript toolbox dictionary
EXAMPLE 1
EXAMPLE 2
EXAMPLE 3