Applescripting Productivity

Do you have a mac? Interested in maximizing productivity? Familiar with progamming?

If so, you may already know the muscle of Automator and the blood that pumps it: Applescript.

If the mention of programming is tempting you to browse off and away, I’ve included a pre-made script that may be worth it to you.

My case for the importance of Applescript:

My office desk has two states- cluttered and faux-organized clutter. The latter is spurred by the fleeting need to be organized amidst toggling focus between digital files and physical papers. It usually amounts to randomly stacking the clutter, and produces neatly stacked items that have nothing in common other than they were within grasp. It looks nice and organized, but is actually counter-productive. At least with the clutter there is a chronological order- the older stuff is on the bottom and the newer stuff is on top.

The point I am trying to gleam from this metaphor is this- If you spent 30 minutes analyzing your desk workflow and developed a thoughtful and elegant order, then it would yield you time exponentially beyond your 30 minute investment and, most importantly, keep your rythym. There’s nothing worse than rolling along on something only to lose your momentum trying to hunt down a lost sticky note. Applescript is the language in which that thoughtful and elegant order is written.

Take, for example, file paths. On a mac, there is no easy way to copy the full path to a file locally or on a server.  If you wanted to tell someone in an email or IM where a file or folder is at on the server, you would have to type it all out- “folder_a > folder_b > folder_c > uhhh… folder_d (i think)”. Wouldn’t it be awesome if you could right-click the file on the server and choose “Copy Path to Clipboard”? Applescript is what makes awesome possible. And, that script is already written! (See below)

Here’s the real beauty of Applescript- any program and all of its commands are accessible from the same script. So, let’s say you have an image in Photoshop that you want to end up on the web. You can use Applescript to tell Photoshop to resize that image, then tell Finder to create a folder for it based on it’s EXIF shot date, and then go back to Photoshop to save it to that folder. The same script could go on to grab that file and open your favorite FTP program to upload it to your photoblog. The possibilities are only limited to your interest.

The Script

tell application "Finder"
    set sel to the selection as text
    set the clipboard to POSIX path of sel
end tell

How to use it

First, you need to install the code. This is where Automator comes in. 

  1. Open Automator from your Applications folder
  2. Choose “Custom” from the start screen 
  3. In the left column titled “Library” choose “Utilities” or “Automator”
  4. Find “Run applescript” in the second left column, and double-click it
  5. Click into the window with all the code, and delete everything until its a blank white window.
  6. Copy and paste the code I provided above into the newly blank code window
  7. Go to File>Save as Plugin
  8. Name it “Copy Full Path”
  9. Make sure “Finder” is selected in the drop down below the name
  10. Realize you are done!

To use the script, open up a Finder window and choose a file. Right-click that file, go down to More >, then Automator > then Copy Full Path. Voila! The full path has been copied to your clipboard.

 Applescript Resources

Interested? Here are some links to get you started.


One Comment on Applescripting Productivity

  1. Thanks! That’s exactly what I’m looking for. I was trying to use automator to do this job with 2 actions “Get Selected Item” and “Copy To Clipboard” I even used the same alias “Copy Full Path”! But it resulted in like “Drive:Path:Filename.Ext”. And your script works well! Cool and thanks again!