Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Help in Applescript?

Hey guys I really need help here...

I've been trying to write an applescript to login my college account.

I got pass the sign in part but im stuck on figuring out how to click a certain button on the webpage.

Did a little research and found that it was either UI scripting that I should use or java command.

But im on OSX Maverix and I can't figure out how to enable UI scripting and how to use it (in doesn't show in the accessibility list)

And for the java commands, I know how to find the source code of a page but i can't figure out how to find the button code, and how to write the script... Any help would be appreciated thank you!

So far thats my script:

set thePassword to *password*

set theID to *IDnumb*

tell application "Safari"

Activate

Open Location *Website*

delay 5

keystroke ID

keystroke tab

keystroke password

keystroke return

delay 2


End tell

MacBook Pro with Retina display, OS X Mavericks (10.9)

Posted on Nov 17, 2013 12:51 AM

Reply
3 replies

Nov 18, 2013 2:59 PM in response to rbassil

Here is how I navigate these two panels. First, I click on the vnc icon. I then curser down to to the line "Connect to Listening VNC Viewer...". Press return. Type in ip address. Press return.

User uploaded file




first part clicks on vnc icon.


User uploaded file


move mouse and click mouse are not standard. They are an applescript addon see comment below. Do not know if available with mavericks.


For you situations you probably do not have to click on the button. Use the tab to move to the button you wish to click. Press return. ( keystroke return )



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


-- Go after screen resolution
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 {474, 14})
else
    (move mouse {698, 11})
end if

click mouse

tell application "System Events"
    repeat 6 times
        key code 125 -- cursor down        key code 125
        delay 1
    end repeat
    delay 2
    keystroke return
    delay 3
    keystroke "192.168.0.101:5900"
    -- if you went to press return after typing the password
    delay 3
    keystroke return

    -- incase we get an error message. should probably be ok, in good case.
    delay 3
    keystroke return

end tell


(* 
    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:


*)

Help in Applescript?

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