As it was a nice London day today – wind, rain, sunny spells and a cosy 15?C all that, I spent the day with my Mac learning how to get more out of Quicksilver. I was wondering for some time how to implement my own actions. The task at hand was to have a single action that allows me to push files to the dropbox folder on my server out in the internet. So all this thing has to do is to create the right command line call. Unfortunately there is no way easy way just to add command using placeholders (or none that I am aware of).
So what you have to do to write an Actions is to write an AppleScript (which has a very idiosyncratic syntax, but feels a bit TCLee ) and put it into the right folder, something like /Users/USERNAME/Library/Application Support/Quicksilver/Actions/MyAction.scpt
So this is the thing I hacked up. It uses growl to notify the user, when the transfer is completed. Unfortunately it doesn’t display an error on failure. I would have to spend more time with AppleScript, but perhaps one of the readers comes up with a solution.
on open these_items repeat with i from 1 to the count of these_items set target to "user@host.com:/home/user/dropbox" set filename to the quoted form ¬ of the POSIX path of (item i of these_items) set theResult to ¬ do shell script "scp -q " & filename & " " & target growl((filename & theResult)) end repeat end open on growl(theText) tell application "GrowlHelperApp" set the allNotificationsList to ¬ {"Test Notification", "Another Test Notification"} set the enabledNotificationsList to ¬ {"Test Notification"} register as application ¬ "Growl AppleScript Sample" all notifications allNotificationsList ¬ default notifications enabledNotificationsList ¬ icon of application "Script Editor" notify with name ¬ "Test Notification" title ¬ "Drop done" description ¬ theText application name "Growl AppleScript Sample" end tell end growl
Verdict: QS rocks!
Leave a Reply