Applescript: How to download linked files from Google Chrome page
I got this to compile correctly on latest OSX

-- DOWNLOAD ATTACHED FILES
tell application "Google Chrome"
    activate
    set num_links to execute front window's active tab javascript "document.links.length"
    repeat with i from 0 to num_links - 1
        tell application "Google Chrome" to set this_link to execute front window's active tab javascript "document.links[" &amp; i &amp; "].href"
        set {ASTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, "/"}
        set fName to last text item of this_link
        set AppleScript's text item delimiters to ASTID
        try
            do shell script "curl -L -o " &amp; quoted form of (destinationFolder &amp; fName) &amp; space &amp; this_link
        end try
    end repeat
end tell