Mouse location in applescript?

Can anyone give me any pointers as to how to get the mouse location when a short script is run?
I don’t need to know where the last click occured, just the mouse location so as to check if it has moved since last time the script was run.

Any ideas?

Can you use third-party scripting additions for this, Simon? If so, you could try something like Xtool, by Jean-Baptiste Le Stang (courtesy MacScripter, of course). :slight_smile: With this little box of tricks installed, you can get mouse co-ordinates using the mouse location command (from the Cursor Suite).

It’s really as simple as this:

mouse location
--> {521, 166}

A little caution with Xtool, at least in OS X 10.3.9: None of the List items except create work, at least for me. The mouse location does, but I’ve never bothered to test any of the others. The author has never answered an e-mail about it.

XTool is a very old osax that I wrote a few years ago, it is no longer supported. My plans are to re-write it again later. I’m sorry for not replying to your mail, do you know the date when you send it?

Apology not necessary; there’s always another way.

I sent the e-mail on March 20, 2005 to the e-mail address listed with the OSAX: xtool (ampersand) tiscali.fr. That particular note concerned the move mouse/mouse click instructions which I thought would be great for GUI scripting. They didn’t work for a move mouse, then mouse click. The instruction would move the mouse over the close button of a window, for example, but the button didn’t respond by showing an “x” and didn’t respond to the click.

I know this is an old thread but has there been any other way of doing this?

Hi,

look at this thread