• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Trouble downloading pdf's
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Trouble downloading pdf's


  • Subject: Trouble downloading pdf's
  • From: Jim Tinkham <email@hidden>
  • Date: Mon, 21 Feb 2011 10:10:31 -0500

I've been using the following script successfully to download pdfs from a couple of sites but now with a new site all I get are corrupt files.

activate application "Finder"
tell application "System Events"
    tell process "Finder"
        keystroke command
    end tell
end tell
tell application "FileMaker Pro 10 Advanced"
    go to database "EZReprint"
    delay 5
    do script "Auto Find MBoC Content"
    delay 5
end tell
tell application "Finder"
    set the FMOut to file "MBoCurl.txt" of folder "Desktop" of home as alias
end tell
tell application "TextEdit"
    activate
    open FMOut
    set cnt to count of (paragraph of the text of the front document)
    set pages to {}
    set fnames to {}
    repeat with p from 1 to cnt
        set rec to paragraph p of the text of the front document
        set bg to 2
        set o1 to offset of "," in rec
        set ed to o1 - 2
        set ppg to text bg thru ed of rec
        set end of pages to ppg
        set bg to o1 + 2
        set o2 to length of rec
        set ed to o2 - 2
        set fnm to text bg thru ed of rec
        set end of fnames to fnm
    end repeat
    quit
end tell
tell application "OmniWeb"
    activate
    delay 5
end tell
repeat with i from 1 to number of items in the pages
    set WebP to item i of pages
    set DlPath to "/Users/mac101010/Desktop/MBoC/" & item i of fnames
    if WebP is equal to "ABORTAUTO" then
    else
        tell application "OmniWeb"
            GetURL WebP to DlPath
        end tell
    end if
end repeat

The filemaker script gives me a text file with the URL of the file to download and the file name to get.  This is a sample line from that file;

"http://www.mbc.org/cgi/reprint/22/1/54.pdf","MBoC_v_22_i_1_p_54.pdf"

Although it doesn't seem to be the main issue in this problem I do need to save the file to a more unique file name then what the site has to download.  I've tried the script without the file rename and still get a corrupt file.  I can only get a good file from this site if I let it download without the "to" part of the command.

I've been trying to do a similar get with FireFox or Safari and haven't found the magic combination.

Can anyone suggest a different way with OmniWeb or a workable way with either FireFox or Safari?

Thanks!!

Jim

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Prev by Date: Re: creating a file within a folder etc...
  • Next by Date: Re: creating a file within a folder etc...
  • Previous by thread: Re: creating a file within a folder etc...
  • Next by thread: Re: Trouble downloading pdf's
  • Index(es):
    • Date
    • Thread