Simulate Mouse Click Using AppleScript

I want to simulate a mouse click using AppleScript. I used click button of window command but unfortunately it only simulates a half click in the sense that you see the button highlighted but the action is not activated. I used a command key function, where I would press a # many times to make the mouse go down. However, this is very slow. I noticed that there is a couple of additional elements that can be used with AppleScript for example XTools and Extra Suites where I can tell the mouse to go to a certain location and click. I am on a Mac OS X 10.3.9 system (I believe I am using a PowerMac as well) and would like to know if any of the two programs are compatible with this system. I would appreciate any help in how I can install the software and what directory to place the software. Thank you very much for your help.

PowerMac, Mac OS X (10.3.x)

Posted on Jul 4, 2013 7:40 PM

Reply
1 reply

Jul 5, 2013 12:39 PM in response to Menatorious

Xtools works for me on an iMac g3 600 with tiger 10.4.11



log "  --- Starting on " & ((current date) as string) & " --- "

-- percent 
set volume output volume 35 without output muted


-- Go after time message
do shell script "/usr/sbin/system_profiler SPDisplaysDataType | grep 'Resolution'" -- get info
tell the result to set {DisplayWidth, DisplayHeight} to {word 2, word 4} -- get resolution

if DisplayWidth = 800 then
    (move mouse {543, 276})
else
    (move mouse {644, 337})
end if

click mouse



-- center mouse
do shell script "/usr/sbin/system_profiler SPDisplaysDataType | grep 'Resolution'" -- get info
tell the result to set {DisplayWidth, DisplayHeight} to {word 2, word 4} -- get resolution
move mouse {DisplayWidth div 2, DisplayHeight div 2} -- center mouse


(* 
    First, there is the XTools scripting addition, which will give AppleScript the ability to move the mouse. 
    
    http://www.lestang.org/osax/XTool/
    XTool-2.0.dmg.tgz 
    
    Installation :

    Drag XTool.osax from insite the image to one of the following locations (create the directory if it does not exist) :

    a : ~/Library/ScriptingAdditions/
    b : /Library/ScriptingAdditions/
    c : /System/Library/ScriptingAdditions/

    I have it in directory /System/Library/ScriptingAdditions/ 
    My other two directories do not exit: ~/Library/ScriptingAdditions/ & 
        /Library/ScriptingAdditions/

.     Next, you will need to place a script application into your login items (System Preferences > Accounts > Login Items) that will move the mouse when you log in:


*)

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Simulate Mouse Click Using AppleScript

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.