Hi.
I’m trying to create an applescript for logging into my server and shutting down my power management settings. I’m very new to this, so I would very much appreciate a push in the right direction.
So far, I’ve got this:
tell application “Safari”
activate
do JavaScript “window.open(‘http://192.168.1.162’)” in document 1
end tell
tell application “Safari”
set contents of user name of window 1 to “test”
set contents of password of window 1 to “test”
end tell
which, unfortunately, does not successfully log me in…it does however, open the webpage successfully, so that’s exciting!
Can anyone tell me the correct syntax for getting the login to work properly? Also, once I’m logged in, how do I set it up to tab through the fields actions so that I can set the right settings and then log out?
ok, from searching the archives, I’ve gotten a lot closer to my goal. So far, I’m able to login and navigate to the correct tabs via keystroke. It works, but I’m starting to wonder if perhaps there’s a more elegant way to get there without having to do tab & tab & tab…?
So, since this is working, I guess I could just close it up and call it a night, but for the sake of learning this language, I wonder if any of you good folks would mind steering me towards a more elegant way of doing this? Is there a way of going directly to a field, tab or button without tabbing through to them? If tab is the only way, how do I set up the ‘option’ modifier key so that it tabs through with less keystrokes?
Thanks much for the tip.
I downloaded the uibrowser and it is in fact, very helpful in finding out the names of the buttons and things. However, I’m not sure what to do with the information. None of the output that it gives me works. For example, it gave me this to put in my script:
click button “Save Settings” of group “” 9 of UI element “” 1 of scroll area 1 of group 3 of window “WebInterfaceForServer3”
It certainly doesn’t work. Maybe I need to put some information between the quotes? I wouldn’t even begin to know what would go in there.