Your best friend for file transfer.

Fetch application logoFetch

Applescript (3 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 23 years ago by jh
  • Latest reply 23 years ago from rosmifetch
  • jh Member

    I am trying to make a selection in a transfer window, and get the contents of the selected file using applescript. What is the proper way to do this? I see that there is a selection-object class, and its property is "contents", but I don't know how to make this work.

    I am hoping I can get the contents of a text file and use the data elsewhere.

    Any suggestions? I am using Fetch 3.0.3.

    Posted 23 years ago #

  • Jim Matthews Administrator

    I don't think you can do that with Fetch 3.0.3, but 4.0b5 has a "selected" property for the transfer window object. So with 4.0b5 you can do this:

    set sel to selected of transfer window 1
    view sel
    set t to text of text window 1

    Jim Matthews
    Fetch Softworks

    Posted 23 years ago #

  • rosmifetch Member

    This might help... This is a snippet I'm using to get an item from a list of postscript RIP dropfolders... instead of having the user choose from within fetch, dump the list back into an applescript "choose from list" dialog box. This snippet checks the fetch listing againt a pre-exisitng "dirignore" list so that the user can't choose the same item at different time intervals. Sorry it's so long...

    -- get a url from a predefined list
    set myurl to putyoururlhere
    -- put your url in above
    set mydir to {}
    display dialog "Wait...
    Fetch is going to do some work" buttons "Okay" default button 1 giving up after 3
    try
    tell application "Fetch 3.0.3"
    activate
    set ignore cache to true
    open url myurl
    set mywind to a reference to transfer window 1
    set fetchcount to count mywind each remote item
    end tell
    -- because 'list' is a Fetch command, I can't use it in the tell statement...
    if fetchcount > 2 then
    repeat with itemcounter from 2 to fetchcount
    tell application "Fetch 3.0.3" to set myname to (name of (a reference to remote item itemcounter of mywind))
    if not (myname is in dirignore) then
    if myname = {} then
    set mydir to {myname}
    else
    set end of mydir to myname as list
    end if
    end if
    end repeat
    tell application "Fetch 3.0.3" to close mywind
    end if
    tell me to activate
    set text item delimiters to ":"
    set onedf to item (count of onedrop) of onedrop
    set oneftp to (choose from list mydir with prompt onedrop & " is linked to ..." OK button name "Connect") as text
    if not (oneftp = "cancel") then
    set myconnection to {onedrop as text, (myurl & oneftp & "/") as text}
    end if
    on error
    display dialog "Can't get Fetch to work" giving up after 2
    end try

    Posted 23 years ago #

Topic closed

This topic has been closed.