Your best friend for file transfer.

Fetch application logoFetch

AppleScript Automation (7 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 11 years ago by chadlindsey
  • Latest reply 9 years ago from Jim Matthews
  • chadlindsey Member

    I need some help creating a watched folder script that does not miss added files to the folder while another file is being uploaded via Fetch. My script sees new files, but not all of them.

    on adding folder items to this_folder after receiving these_items
    with timeout of 300 seconds
    set myUser to "xxxx"
    set myPassword to "xxxx"
    set myHost to "xxxxxxx"
    set myDirectory to "/home/directory/"
    set myurl to "ftp://" & myUser & ":" & myPassword & "@" & myHost & "/" & myDirectory
    end timeout
    with timeout of 300 seconds
    tell application "Fetch 4.0.3"
    set myBinPref to the add bin suffix
    set the add bin suffix to false
    put into url myurl item these_items text format Raw Data binary format Raw Data
    set the add bin suffix to myBinPref
    quit
    end tell
    end timeout
    end adding folder items to

    thanks much!
    Chad

    Posted 11 years ago #

  • Jim Matthews Administrator

    What version of Mac OS are you running?

    Thanks,

    Jim Matthews
    Fetch Softworks

    Posted 11 years ago #

  • chadlindsey Member

    I am running OSX (10.2.6) and Fetch 4.03.

    Thanks, Chad

    Originally posted by JimMatthews:

    What version of Mac OS are you running?

    Thanks,

    Jim Matthews
    Fetch Softworks

    Posted 11 years ago #

  • Jim Matthews Administrator

    I apologize for taking so long to answer; I had to do some testing of my own. This script works for me, even if I drag files into the folder while Fetch is busy uploading:

    on adding folder items to this_folder after receiving these_items
    try
    tell application "Fetch 4.0.3"
    with timeout of 60000 seconds
    put into url "ftp://matthews:@Unit.local/Sandbox/" item these_items
    end timeout
    end tell
    on error errorMsg
    display dialog "There was an error trying to put " & (these_items as string) & ": " & errorMsg
    end try
    end adding folder items to

    It also reports any errors that occur. Does this script work for you (after changing the URL)?

    Thanks,

    Jim Matthews
    Fetch Softworks

    Posted 11 years ago #

  • chadlindsey Member

    Jim,
    THANK YOU! works flawlessly!
    I have been racking my brain trying to figure this out.
    thanks again!
    Chad

    Posted 11 years ago #

  • Simoncmg Member

    I have tried to use your applescript to automate FTP upload on a watched folder. But I get an error saying invalid password even when I am already connected to the ftp site . Do I need to put the username and password into the applescript?

    Posted 9 years ago #

  • Jim Matthews Administrator

    You need to include the user id in the script, but you can leave out the password and have it pulled from the Keychain. If that is not working could you post the script?

    Thanks,

    Jim Matthews
    Fetch Softworks

    Posted 9 years ago #

Topic closed

This topic has been closed.