Your best friend for file transfer.

Moving files into the active Fetch window with folder action not working (4 posts)
- Started 11 years ago by Andrew
- Latest reply 11 years ago from Jim Matthews
-
Andrew Member
-
Jim Matthews Administrator
Hi,
You might try changing
put into transfer window "MyFolder" item added_items
to
put into transfer window "MyHostName" item added_items
Transfer windows can be referenced by the complete window title, or by the hostname, but not by the folder name.
Alternatively, transfer windows can be referenced directly. The "make new transfer window" command returns a transfer window reference. So you could say:
set myTransferWindow to make new transfer window at beginning with properties {hostname:"MyHostName", username:"MyUserName", password:"MyPassword", initial folder:"MyFolder"}
put into myTransferWindow item added_itemsOr you could skip dealing with transfer windows entirely and replace both lines with:
put into url "ftp://MyUserName:MyPassword@MyHostName/MyFolder/" item added_items
If you leave out the "activate" line Fetch should not pop into the front.
Thanks,
Jim Matthews
Fetch Softworks -
Andrew Member
Hey Jim,
I used your second suggestion it worked, thanks!
So the script looks like this now:on adding folder items to this_folder after receiving added_items
tell application "Fetch"set myTransferWindow to make new transfer window at beginning with properties {hostname:"MyHostName", username:"MyUserName", password:"MyPassword", initial folder:"MyFolder"}
put into myTransferWindow item added_itemsend tell
end adding folder items toTwo followup tweaks that would help immensely:
I'd like to empty the folder (the one this folder action is on) AFTER the Fetch upload;
And it looks like I need Fetch to quit when done--it is reopening a transfer window after a few moments
for some reason.
Any tips on either of these things?Thanks again. :)
Andrew -
Jim Matthews Administrator
Hi,
To quit Fetch, just put a line that says:
quit
before "end tell".
Rather than emptying the folder, I would tell the Finder to move the added_items to the trash. I think this would work:
tell application "Finder"
move added_items to trash
end tellThanks,
Jim Matthews
Fetch Softworks
- Page 1
Hi,
I'm a newbie trying to write a simple applescript--a folder action--that will, when a new file (a jpeg) hits a particular folder, launch Fetch and move the new file into a particular directory on my server. Fetch is launching, but my files aren't uploading.
Here's what I've written so far:
on adding folder items to this_folder after receiving added_items
tell application "Fetch"
activate
make new transfer window at beginning with properties {hostname:"MyHostName", username:"MyUserName", password:"MyPassword", initial folder:"MyFolder"}
put into transfer window "MyFolder"
added_items
end tell
end adding folder items to
Any help would be appreciated! Also--if it's possible to do this without Fetch jumping to the front, most active window, that would be a nice bonus, too.
Andrew
Posted 11 years ago #