You are not logged in.
Thanks to Ben Waldie's new book, Automator for Mac OS X 10.5 Leopard: Visual QuickStart Guide, I now have a new friend in my circle of scripting. I know that a number of AppleScripters eschew Automator, and I admit that until I read Ben's book, I was a closet member of that group. Not anymore. Automator has some extremely cool, useful, and easy to learn functions that offer us some simplified methods to personalize our machines, and just plain do some nifty things.
Our topic today, of course, is the Automator way of creating droplets. In my opinion, there is not an easier way to create a droplet outside of Automator, notwithstanding my world famous article: "AppleScript Tutorial for Beginners IX - Getting the Drop on Droplets". For instance, let's explore the droplet I mentioned in that same article about my kid's GarageBand tracks. When they have created something truly extraordinary (or so they believe, anyway), they typically export the project in full CD quality to burn onto a disc for my wife (she has yet to join the iPod generation). I subsequently take those .aif files, and drop them onto a simple droplet to convert them to AAC, add them to a particular playlist in iTunes, attach them to a Mail message to my parents, and send the mail.
Building the Basic Automator Action
Using AppleScript, I spent an hour or so getting the code and variables just right, running some tests, adding plenty of comments to myself for later, etc., etc. Using Automator, I stacked up four actions, added some specifics for those actions, and was done in five minutes. Take a look at this baby:
Applescript:
on run {input, parameters}
set Next_Image_File to (path to desktop as Unicode text) & "NewAutomatorSS.png"--This is the original dropped image, with its first new name
tell application "Finder"
set Last_Name to the name of file -1 of folder (item 1 of input)--This is the last file in the folder passed from the previous action
set ss_num to (characters -6 thru -5 of Last_Name as text) as number--Analysis of the two digit number of that file
set New_img_Name to ("AutoDrop" & text -2 thru -1 of ("0" & ((ss_num + 1) as text)) & ".png")--Generation of new name for the original image
set name of file Next_Image_File to New_img_Name--Actual changing of the name of the original image
end tell
return file ((path to desktop as Unicode text) & New_img_Name) as alias--Passing of a file reference to the new image to the next action
end run
When using a Run AppleScript action, understand that the variable input is always a list of whatever is being passed from the previous action. In my case, it is a list of 1 folder. I simply grab the last file in that folder, set the name of the file I had already re-named in the first action of the workflow to the next number in sequence, and then pass that file to the next action using the return command. The next action is my Move Finder Items from the original workflow, unchanged:
Craig Smith
Offline
Man you have some mad skills... I don't have kids but as a son I'd love to have my father build me an application like this I'm going to try to replicate this and I'll report back.
Oliver [at] hemorrhoid treatment X dot Org.
Offline