I volunteer with a non-profit that maintains a database of all of its classes,
workshops, etc. I have written a number of AppleScripts that take advantage of the
“do JavaScript” function in Safari to post data about the events to sites that
advertise events. The purpose of this is to avoid rekeying the data in the database.
I review all posts before they are submitted and I do all of the Captchas manually.
I am now working on a web page with the following html.
Select your Event date
Clicking on either link causes a different
get to the right link using the following:
tell application "Safari"
do JavaScript "
var jLinks = document.getElementsByTagName('a');
for (var i = 0; i < jLinks.length; i++) {
if (jLinks[i].innerHTML == 'Calendar View') {
alert(jLinks[i].innerHTML);
// How do I select jLinks[i]?
}
if (jLinks[i].innerHTML == 'Advanced View') {
alert(jLinks[i].innerHTML);
// How do I select jLinks[i]?
}
}
" in document 1
end tell
What I can’t figure out how to do is to select the link in JavaScript.
When it is a link that points to a page, I just grab the URL and load the page,
but here I want the “side effects” of the link which were presumably set by
some other JavaScript.
Suggestions?
Thanks,
Jerry
Model: iMac
AppleScript: How do I find this?
Browser: Safari 531.21.10
Operating System: Mac OS X (10.5)