Adrian Sol Adrian Sol - 2 years ago 113
AppleScript Question

While Click at. Can't get the process "X"

The intention is to perform a single click at (x, y). I did try this method found on internet.

tell application "System Events"
tell process "X"
click at {350, 50}
end tell
end tell

And get an error System Events got an error: Can’t get process "X".
After I did carefully look up in the AppleScript dictionary and found that it's a responsibility of
Process Suite
and gave it another shot, but still get the same error.

Can you please suggest what has been done wrong?

Answer Source

"X" would be the process that you want to perform the click (ex. Safari, Finder, etc). I've found that it can also be omitted.

tell application "System Events"
    click at {0, 0}
end tell

This should activate the Apple menu in the top left. You can use the crosshairs from the screenshot tool (⌘ + ⌃ + ⇧ + 4) to determine coordinates of objects on your screen. If the application needs to be active beforehand you can do something like

tell application "System Events"
    tell process "Safari"
        click at {20, 40}
    end tell
end tell
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download