Your best friend for file transfer.

Fetch application logoFetch

Connection is invalid in Applescript (5 posts)

  • Started 18 years ago by Steve-1205
  • Latest reply 18 years ago from Steve-1205
  • Steve-1205 Member

    I teach at a small university and use Fetch in and Applescript to FTP copies of my course gradebooks to a Web server. This allows the students to keep up with their progress during the term. (The students access their grades through a PERL script that requires a password and restricts their access to only their grades.)

    The Applescript code to transfer the files is:

    tell application "Fetch"
    activate
    make new transfer window at beginning with properties {hostname:"server.name.edu", username:"usernamehere", password:"passwd-here", initial folder:"/vault"}
    put into transfer window "server.name.edu" item alias "Dr. Steve's HD:Users:zzzz:Desktop:class-gb.txt"
    quit
    end tell

    This worked well in Fetch v.4. Fetch 5 gives me a "Connection is invalid" error message that highlights the QUIT command above.

    Any ideas as to what I am doing wrong?

    Thanks for your help.

    //steve

    Posted 18 years ago #

  • Steve-1205 Member

    While trying to figure out my wayward path with this problem, I looked at the "Event Log" in Applescript. It reported:

    quit
    current application
    "Fetch 4.0.3 got an error: Connection is invalid."

    I'm using Fetch 5.02, not version 4.

    I upgraded by moving Fetch 5 to my applications folder, replacing the Fetch icon on my dock and trashing my copy of Fetch version 4.

    Could this error be because I need to change the "preferences" files for Fetch?

    Thanks for your help.

    //steve

    Posted 18 years ago #

  • Steve-1205 Member

    To make things simple, I stripped the Applescript to:

    tell application "Fetch"
    activate
    quit
    end tell

    When this runs, the Applescript error log returns:

    tell Application "Fetch"
    activate
    current application
    activate
    quit
    current application
    "Fetch 4.0.3 got an error: Connection is invalid."

    Before running this script, I trashed the Fetch application (version 5.02--version 4 was trashed when I installed version 5) plus the Fetch Cache, Fetch Prefs and Fetch Shortcuts files from the library.

    I don't understand why I cannot get Applescript to quit Fetch without the "Connection is invalid" message and why Fetch 4.0.3 gets this message.

    Any ideas? Does the "quit" command still work in Applescript?

    //steve

    Posted 18 years ago #

  • Jim Matthews Administrator

    That's a bug in Fetch. You can work around it by replacing the quit line with this:

    try
    quit
    end try

    Jim Matthews
    Fetch Softworks

    Posted 18 years ago #

  • Steve-1205 Member

    Cool!

    That is the answer!

    Thanks.

    //steve

    Posted 18 years ago #

Reply

  • Or nickname, if you prefer.
  • This will be kept confidential.
  • This is to ensure that you’re a person, not a spambot.