mouse position

There are a lot of threads about this but most are older than 2003 and they seem to be out of date.
I’d like to click a link in safari and find it’s mouse location.
What do I use and what is the accompanying script for the osax addition?
xtools seems out of date and extra suites doesn’t seem to have the ability.

Do you have developer tools installed? If so there’s an application called Pixie that shows mouse coordinates. You can see them in the lower left corner of the window, and if not then go to the preferences and check the box to show them. I don’t know how to script it but maybe it will do what you want. Find it in /Developer/Applications/Graphics Tools/

If you need the absolute coordinates (ie, from the top left of the entire screen), a nifty trick is to hold down apple-shift-4, which is the shortcut for taking a screenshot with only a certain portion of the screen selected - it also gives you the absolute x, y coordinates of the mouse. When you have your coordinates, just press escape to get out of screenshot mode.

Sky,

That is awesome. I use SnapsProX so I had not seen that little trick.

I also use Extra Suites to perform mouse clicks and set this script
up to quickly get mouse locations and format them for ES.
I set up a hot key using Drag Thing.

The following script will get your mouse location and format it
with the set myLoc line and put it on the clipboard.

Regards,

Craig

set myLoc to my getMouseLocation()

set myLoc to "{" & (item 1 of myLoc) & ", " & (item 2 of myLoc) & "}" & ", " as string

set the clipboard to myLoc

on getMouseLocation()
	tell application "Extra Suites"
		set mouseLoc to (ES mouse location)
	end tell
	return mouseLoc
end getMouseLocation

This is excellent and exactly what I am looking for. I have a few questions. If I build this into an AppleScript Studio application, will I be able to compile it and give to a user that doesn’t have Extra Suites? Also, I am currently getting the pop up as I have not registered it, if I register, will other users of the compiled script still see the pop up?

Thanks for the help and this excellent solution,
Brett

I just answering my question, unfortunately it looks like it is prompting the user for their location of “Extra Suites”.

I no longer use Extra Suites but instead use Cliclick
http://www.bluem.net/en/mac/cliclick/

Cheers,

Craig

Thanks craig, this is extremely helpful for clicking and it is definitely fast!! However, it looks like it doesn’t have functionality for getting mouse coordinates which is definitely what I am trying to do at this moment.

Since you are using this inside an AppleScript Studio app you can
use the Objective-C Event class method mouseLocation. It returns an
NSPoint with Screen coordinates.

From the Docs.

mouseLocation
Reports the current mouse position in screen coordinates.

  • (NSPoint)mouseLocation

Discussion
This method is similar to the NSWindow method mouseLocationOutsideOfEventStream. It returns the location regardless of the current event or pending events. The difference between these methods is that mouseLocationOutsideOfEventStream returns a point in the receiving window’s coordinates and mouseLocation returns the same information in screen coordinates.

You should check it out. It doesn’t look very hard to implement.

Cheers,

Craig