Mouse coordinates
MacBook Pro, Mac OS X (10.6.1)
MacBook Pro, Mac OS X (10.6.1)
property parent : class "NSObject"
on applicationWillFinishLaunching_(aNotification)
-- Insert code here to initialize your application before any files are opened
end applicationWillFinishLaunching_
on applicationShouldTerminate_(sender)
-- Insert code here to do any housekeeping before your application quits
return current application's NSTerminateNow
end applicationShouldTerminate_</pre>
property parent : class "NSObject"
property pNSEvent : class "NSEvent"
on applicationWillFinishLaunching_(aNotification)
-- Insert code here to initialize your application before any files are opened
my performSelectorwithObject_afterDelay("getMouseXY", missing value, 0)
end applicationWillFinishLaunching_
on applicationShouldTerminate_(sender)
-- Insert code here to do any housekeeping before your application quits
return current application's NSTerminateNow
end applicationShouldTerminate_
on getMouseXY()
set mouseLocation to pNSEvent's mouseLocation() as list
set xMouse to item 1 of mouseLocation as integer
set yMouse to item 2 of mouseLocation as integer
display dialog "X=" & xMouse & ", Y=" & yMouse giving up after 1
my performSelectorwithObject_afterDelay("getMouseXY", missing value, 0.1)
end getMouseXY</pre>
Mouse coordinates