• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Move cursor with Applescript
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Move cursor with Applescript


  • Subject: Re: Move cursor with Applescript
  • From: Craig Williams <email@hidden>
  • Date: Sat, 3 Apr 2010 12:53:05 -0600

I'm trying to change an iKey function to a script.

(*
ClickZoomBox - 4/3/10    
*)
tell application "System Events"
 Move cursor to 57,12 (T/L)
click -- click left mouse button
end tell


Moving the mouse and clicking can be achieved using cliclick -> http://www.bluem.net/en/mac/cliclick/
ex.
do shell script "cliclick 51 17"


If you only want to move the mouse and not perform a click then you can use CGWarpMouseCursorPosition(). 

Here is an example using MacRuby but you could easily turn this into a command line utility.
set x to 57
set y to 12
do shell script "/usr/local/bin/macruby -e \"framework 'carbon'\" -e \"framework 'ApplicationServices'\" -e \"CGWarpMouseCursorPosition(CGPointMake(" & x & "," & y & "))\""

Regards,

Craig
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Move cursor with Applescript
      • From: Robert Poland <email@hidden>
  • Prev by Date: RE:MS Word window sizes
  • Next by Date: Re: Move cursor with Applescript
  • Previous by thread: Re: Move cursor with Applescript
  • Next by thread: Re: Move cursor with Applescript
  • Index(es):
    • Date
    • Thread