Using Click in AppleScript

Discussion in 'Mac Programming' started by rebello95, Nov 7, 2011.

  1. rebello95 macrumors member

    Joined:
    Jun 15, 2011
    Location:
    USA
    #1
    tell application "System Events"
    tell process "Minecraft"
    click at {896, 157}
    end tell
    end tell
    end
    end

    for some reason it's not working, even when I try it with Safari. Ideas?
     
  2. Partron22 macrumors 68000

    Partron22

    Joined:
    Apr 13, 2011
    Location:
    Yes
    #2
  3. rebello95 thread starter macrumors member

    Joined:
    Jun 15, 2011
    Location:
    USA
    #3
    I got click at to work for Safari, but not minecraft. I saw cliclick but I don't want people to have to install that. This procedure is being used in an application I'm making, so I need actual code.
     
  4. Partron22 macrumors 68000

    Partron22

    Joined:
    Apr 13, 2011
    Location:
    Yes
    #4
    This has most of what you want:
    Move and click the mouse via code
    But CGPostMouseEvent() is deprecated, so mod the code accordingly:
    CGPostMouseEvent replacement on Snow Leopard

    Install the resulting shell command in your App's bundle, and call it with a 'do shell script' or an Objective C launchedTaskWithLaunchPath:arguments:.
     

Share This Page