Simple script to be run as an action with Quicksilver. I select a file, it uploads via Transmit, and copies a TinyURL to the clipboard.
But I can’t get the filename from the selected file:
on open these_items
-- bring Transmit to the foreground
activate application "Transmit"
tell application "Transmit"
-- create new window to upload files with
make new document at before front document
tell document 1 -- send commands to the frontmost document window
tell session 1 -- sends commands to the first session in the window
-- connects to the favorite with the name specified
if (connect to favorite with name ".Public") then
-- upload all items dropped onto the droplet
try
repeat with the_item in these_items
-- ignoring result from upload
upload item the_item
say "Uploaded!"
--- I need help here:
set itemsFilename to file_name of item the_item
say itemsFilename
--- This does not work. I need this for the tinyURL part below
end repeat
end try
else
say "Sorry, could not connect to favorite."
end if
-- once the upload has finished, disconnect
disconnect
say "Disconnected!"
set the clipboard to (do shell script "curl --url \"http://tinyurl.com/api-create.php?url=http://homepage.mac.com/matthew/.public/" & itemsFilename & "\"")
say "TinyURL copied to clipboard."
end tell
end tell
end tell
end open
Everything else works except the part commented otherwise.
Help appreciated!