I want to be able to download all the files from the links on a webpage but the links are embedded in a javascript:open new command. Would it be possible to give me some hints as to how to write a script which would automate the download of the files behind the links. The web URL is
tell application "DEVONagent"
set theBrowser to browser 1
set theSource to source of theBrowser
set theURL to URL of theBrowser
set cnt to (do JavaScript "document.links.length" in theBrowser) as integer
set i to 0
repeat while i < cnt
set theLink to do JavaScript "document.links[" & (i as string) & "].href" in theBrowser
if theLink begins with "javascript:opennew('" then
set od to text item delimiters of AppleScript
set text item delimiters of AppleScript to "'"
set theLink to (text item 2 of theLink) as string
set text item delimiters of AppleScript to od
add download theLink referrer theURL
end if
set i to i + 1
end repeat
end tell