Howdy guys!
The subject of this posting might be a little confusing so here is what I actually want to achieve:
I created an Automator workflow to upload a selected file or directory from Finder to my FTP server, using the “Get selected Finder items” and Transmit’s “Upload files” action.
Uploading worked pretty great with that configuration, but I wanted more!
I wanted the URL of the uploaded file to be on the clipboard, so that I can easily post it to chats etc.
I’m a complete newbie to AppleScript but somehow wrote the script below and put it between the Finder and the Transmit action.
The script extracts the filename from input and posts the URL to the clipboard. That works!
The only problem is, that it’s output doesn’t seem to be the same as it’s input, so that Transmit doesn’t work anymore and isn’t uploading anything
This is the code, any improvements are appreciated! :rolleyes:
on run {input, parameters}
copy input to theSelected
set outputPathList to {}
repeat with anItem in theSelected
set AppleScript's text item delimiters to {":"}
copy last text item of (anItem as string) to end of outputPathList
end repeat
set AppleScript's text item delimiters to return
set outputString to outputPathList as string
set AppleScript's text item delimiters to ""
set the clipboard to "http://pascal.foo/stuff/" & outputString
return input
end run
Thank you!
Pascal