I’d like to open IE, open a specific webpage, send a click of a specific button on that page. How do I do this ?
I have tried recording in the AppleScript editor but nothing shows up as I do these actions.
The record function in Mac OS X is limited to only a few applications, unfortunately “IE” and the “Finder” are not recordable. To open a web page in “IE” you can use this simple code…
tell application "Internet Explorer"
GetURL "http://macscripter.net"
end tell
To click on a specific button would be a lot more difficult. You might be able to accomplish it via “GUI” scripting but it would require a lot of work to get it right every time. Another possibility would be using “Extra Suites”, which can place the mouse coordinates to a specific location.
Thanks for the reply. I just realized i may have an easier method of getting there. The buttons are tab stopped. So once I have a page, I know I need to do x tabs and then a return.
Is this possible with the script ?
You might be able to use Extra Suites to do the tabbing.
tell application "Internet Explorer" to Activate
tell application "Extra Suites"
repeat 2 times
type key "tab"
end repeat
end tell
Can I suggest a smartest way? 8)
IE provides a cool command: “do script” (now Safari’s “do JavaScript” works too!); which will allow you execute any javascript code, which is the best way to access any DOM element. This simple example will do a search for “applescript” in MacScripter’s news (bottom form at http://www.macscripter.net/):
tell application "Internet Explorer"
do script "with (document.forms[2]) { // third form on the page
elements[1].value='applescript'; // set value of search field
submit(); // submit the form = click button "Search News"
}"
end tell
Whew! Thanks, jj, I was going to rip my hair out when I read about GUI scripting (no offense to those who posted that… That is one of the reasons GUI scripting is so frustrating - it gives the people who write applications the excuse to not include real scripting.
I don’t like a lot of things Microsoft, but that do script command was wonderful when I was hitting some sites that URL Access Scripting couldn’t handle. Of course, OS X has curl, which can mimic almost anything, and Apple put the do javascritp command in Safari - hooray!
Thanks to all for the help on scripting with IE !