Your best friend for file transfer.

Fetch application logoFetch

applescript /uploading files (4 posts)

This is an archived topic. The information in it is likely to be out-of-date and no longer applicable to current versions of Fetch.
  • Started 13 years ago by btaylor
  • Latest reply 9 years ago from marino
  • btaylor Member

    Hi all,

    I am trying to automate an upload process: replace a folder of (.pdf) files on a remote ftp server with a local copy. I have been testing a single file transfer

    store alias "MYDISK:PDF:AFILE.PDF" host "ftp.bogus.com" user "abcd" password "xyz" path "PDF/BFILE.PDF"

    The connection is made and the PDF directory is accessed, however I consistently get an error "A file was not found" and no file is listed in the directory

    Any help appreciated

    cheers Bill

    Posted 13 years ago #

  • btaylor Member

    Well I seem to have solved most of my problem with

    tell application "Finder"
    open file "Fetch 4.0" of folder "Fetch 4.0 Folder" of startup disk
    end tell
    tell application "Fetch 4.0"
    activate
    close shortcut window 1
    set remotedir to remote directory "ftp://......."
    open remotedir
    put into remotedir item alias "MYHD:PDF:"
    close transfer window 1
    quit Application "Fetch 4.0"
    end tell

    unfortunately the close shorcut window 1 does not have the desired effect, when fetch launches the default connection window is displayed and has to be manually closed before the script proceeds, I wonder what command I need to do that automtically

    Posted 13 years ago #

  • btaylor Member

    Okay, so it looks like I solved my own problem completely now...

    To avoid the default connection window coming up, create a short cut for the require connection. The shortcut can be edited to include the password as it is simpley a text file. The in the script, getthe finder to open file <the shortcut>, then proceed as before:

    tell application "Finder"
    -- Openning a Shortcut skips new connection screen
    -- fetch shortcuts are in plain text as follows
    --DIR ftp://username:password@host/folder
    open file "PDFupdate" of folder "Fetch 4.0 Folder" of startup disk

    end tell
    tell application "Fetch 4.0"
    activate
    set remotedir to remote directory "ftp://username:password@host/folder"
    --open remotedir
    put into remotedir item alias "MYHD:PDF:"
    close transfer window 1
    quit Application "Fetch 4.0"
    end tell

    Posted 13 years ago #

  • marino Member

    Your problem between your second and third post was how to bypass the "New Connection" dialog. Your workaround was to open a shortcut first.

    I had been doing the same thing for 2ears but for some reason it became impractical.

    You can permanently get rid of the "New Connection Window at startup" in Preferences/Misc.

    This should be in the FAQ.
    Cause otherwise Fetch is extremely easy to AppleScript just with the Script Editor recorder.

    Posted 9 years ago #

Topic closed

This topic has been closed.