PDA

View Full Version : Please help: Automator Workflow/AppleScripting Re: Webpages


SonOfSylvanus
2005-12-10, 20:29
If you give advice, please bear in mind that I have no Programming/AppleScript/Automator experience beyond the past few hours, so KIS! Thanks very much.

----------------------------------------------------------------

Short story:

I am using Automator to try to automate the online renewal of my university library books to definitively avoid any late fees (up to 0.50 an hour!) and I am at the stage in my scripting where I want to automatically choose the second option in this drop down menu.

http://www.sonofsylvanus.homechoice.co.uk/images/drop_down2.jpg

The HTML for the "drop down menu" ("form item"? "pop up"? What is the correct name here?) is:

<SELECT NAME="RENEWALLUBID">
<OPTION VALUE= >Renew checked items
<OPTION VALUE=1@LSEDB20040722004653>
Renew all items from London School of Economics & Political Science
</SELECT> Does anyone know of a script/combination of automator actions that can automatically do this for me?

Thanks!

:)

----------------------------------------------------------------

Long story:

This is my Automator workflow so far.

Key to Actions
(1) - Finder finds the correct LSE Library html link in the Finder.
(2) - Finder opens this LSE Library html link in Safari.
(Disabled) - An AppleScript hides Safari so that the process is heretofore invisible.
(3) - A pause here prevents errors resulting from pages not being rendered yet.
(4) - The Ottomate (http://www.ottomate.org/automator/index.htm) "Click Link or Button in Current Webpage" action clicks the correct "My Account" html link. (I can't navigate to this in (1) becuase the "My Account" link is session sensitive.)
(5) - A pause here prevents errors resulting from pages not being rendered yet.
(6) - The Ottomate (http://www.ottomate.org/automator/index.htm) "Set Form Values in Current Webpage" action fills in my Library Barcode (user ID)
(7) - The same action fills in my PIN (password).
(8) - The same action fills in my Last Name.
(9) - The "Click Link or Button in Current Webpage" action clicks the "Login" html link.
(10) - A pause here prevents errors resulting from pages not being rendered yet.
(Need Your help to choose the second option in the drop down please!)
(11) - The "Click Link or Button in Current Webpage" action clicks the "Renew Items" html link.
(Disabled) - An AppleScript quits Safari.

Steps (1) - (4) Steps (5) - (9) Steps (10) - (11)
http://www.sonofsylvanus.homechoice.co.uk/images/renew_steps1-4_thumb.jpg (http://www.sonofsylvanus.homechoice.co.uk/images/renew_steps1-4_big.jpg) http://www.sonofsylvanus.homechoice.co.uk/images/renew_steps5-9_thumb.jpg (http://www.sonofsylvanus.homechoice.co.uk/images/renew_steps5-9_big.jpg) http://www.sonofsylvanus.homechoice.co.uk/images/renew_steps10-11_thumb.jpg (http://www.sonofsylvanus.homechoice.co.uk/images/renew_steps10-11_big.jpg)

http://www.sonofsylvanus.homechoice.co.uk/images/renew_library_books3.jpg

...

According to PreFabUIBrowser (http://www.prefab.com/uibrowser/), this is the reference of the "pop up button" (drop down menu):

pop up button 1 of group 39 of UI element 1 of scroll area 1
of group 4 of window "http://catalogue.lse.ac.uk/cgi-bin/Pwebrecon.cgi" However, I don't see how UI scripting can work in this situation, because the number of books I will be borrowing at any one time will differ from the next, and so "group 39" will change to another number.

I've spent all day way out of my depth, does anyone have any ideas on how to solve my specific problem? (I bet its really easy). I must say that I am surprised that Apple doesn't include in Automator, actions that click on buttons and drop down menus in webpages for you.

Oh- one other thing: I would also like to make the entire process run in the background, without Safari ever becoming the foremost application. Any ideas on that front?

Thanks one and all. Now, I'm gonna go fly around the world again...

;)

Brad
2005-12-10, 20:53
The HTML for the "drop down menu" ("form item"? "pop up"? What is the correct name here?)

"pop-up menu (http://developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelines/XHIGControls/chapter_18_section_3.html#//apple_ref/doc/uid/TP30000359-TPXREF132)"

http://developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelines/art/ct_popmenupopped.gif