Is it possible, with AppleScriptObjC, to move the mouse/cursor to a given position?
Thanks to Shane, I’m able to get the mouse position with: (current application's NSEvent's mouseLocation()) as list but can’t figure out how to set it.
Is there a Core Graphics method usable with Applescript or any other hidden gem?
Jonas. I use the solution posted by Mark_FX on the MacScripter’s site:
use framework "Foundation"
use framework "CoreGraphics"
set cursorPoint to current application's NSMakePoint(500, 500)
current application's CGWarpMouseCursorPosition(cursorPoint)
set displayID to current application's CGMainDisplayID()
set cursorPoint to current application's NSMakePoint(10, 10)
set hadError to current application's CGDisplayMoveCursorToPoint(displayID, cursorPoint)
if hadError as boolean then error "Set mouse position failed."