Restore mouse location for applecript

hey there, i have a bigger applescript going on that does some click action on my 3 screens. now i wonder if there is an easy way to restore the last mouse location before running the applescript, so it jumps back to this position after the script is finished.

thanks for any insights. johannes

ok, found a simple non applescript solution. searchfunction is king! :slight_smile:

Screen Shot 2020-02-28 at 17.43.19

1 Like

@Johannes. Your solution works for your needs. Just in case you don't know about this - if you didn't want to use AppleScript when clicking around, you can also use the Move and Click action that has the Restore Mouse Location as well.

When I was shown this, my feelings hurt for 3 days....


1 Like

To set you can use %CurrentMouse%[]=mouse&s[]=token

as in

1 Like

great replies! thanks.
@kcwhat i think in my case the click action makes no sense. since would than have to split the script (that btw. contains multiple clicks in sequence …)

@hello basically the same as individual coordiantes but more simple in terms of data storage, right?

I figured as much but didn't know because your AppleScript wasn't visible. It was just an FYI in case you didn't know. Glad yours works though.

1 Like

right, and since it's the official one better supported.

You can then call it from other macros:

and to restore just use it the same way it you are currently doing: