Mac Hacks: 17 AppleScripts To Make Your Life Easier

Advertisement

If you are an experienced professional, chances are you have a good set of tools and a work process that you repeat on a daily basis to handle your work. That’s good; it’s how you become more productive, and become an expert. But with repetitive processes come repetitive mechanical work. Whether it’s opening a file in Photoshop to change the format or adding an iCal to-do item based on an email you received, these little tasks can be streamlined. That’s the purpose of AppleScripts.

AppleScript is a scripting language developed by Apple to help people automate their work processes on the Mac operating system. It accomplishes this by exposing every element of the system’s applications as an object in an extremely simple, English-like language. AppleScript is to the Mac OS as JavaScript is to browsers.

Quite a few AppleScripts are available on the Web, ready for you to use, so you don’t even need to look at their code. This article presents you with 17 of the most useful ones.

If you’re interested in learning this language, here are some good resources to get started:

First, Where To Put Your AppleScripts

After you download a script, you have to know where to put it to start using it. For this purpose, let’s say that there are three different kinds of AppleScripts, each of which is used for a different purpose.

Simple Scripts

You put these scripts in a special folder and call them when you need them. You can invoke them just by double clicking on them, but calling them contextually is a lot more effective. Using the Script Menu is one way to achieve this.

To activate the Script Menu, first open the AppleScript Utility app in the /Applications/AppleScript folder and check “Show Script Menu in menu bar.”

AppleScript Utility screenshot

The Script Menu will show a list of AppleScripts that come with Mac OS X, plus your application-specific scripts. To add a script to an application, simply put it in ~/Library/Scripts/Applications/<NAME_OF_THE_APPLICATION>. If that folder doesn’t exist, you can create it.

For example, if you had a Safari AppleScript, you’d put it in ~/Library/Scripts/Applications/Safari. From then on, if you clicked the Script Menu when Safari was active, your script would appear at the top of the list for you to use.

Simple Script screenshot

Droplets

Droplets are AppleScripts that live in the Finder’s toolbar. To use it, all you need to do is drop a file or folder into it. This is very useful for when a script affects a file or the contents of a folder, because all you have to do is drop the target of the action onto the script’s icon.

To “install” a Droplet, first save it in a folder of your choosing: ~/Library/Scripts/Droplets is a good place. Then just drag the script to the Finder’s toolbar.

Droplet Screenshot

Folder Actions

Folder Actions are AppleScripts that are “attached” to a folder. They are executed every time you perform an action with that folder. Folder Actions can get triggered every time you add a file to a folder, remove a file, modify its items, etc. The behavior depends on how the script works, but you can imagine how useful that would be.

To add a Folder Action to a folder, right-click it to bring up the contextual menu, and click Attach a Folder Action. The default location for Folder Action scripts is /Library/Scripts/Folder Action Scripts, but if you want to keep all your custom-installed scripts in one place, ~/Library/Scripts/Folder Actions is a good place to keep them.

Folder Action Screenshot

Multimedia Processing

1. ConvertImage

This is a great example of how Droplets are useful. Just drop an image file into ConvertImage, and you will be prompted to choose from a list of file formats. Pick a format, and it saves it in the same folder as your original file.

ConvertImage
Type: Droplet
Requirements: OS X 10.4+, Image Events

Convert Image Screenshot

Conver Image Screenshot with file formats

2. QuickTime to Photoshop

Exports QuickTime frames directly to Photoshop. All you have to do is pause a video at the frame that you want to export, and then invoke the script. If Photoshop is closed, the script will activate it for you. After it imports the frame, it will ask you if you want another frame from the QuickTime file.

QuickTime to Photoshop
Type: Simple Script
Requirements: Adobe Photoshop CS4

Quick Time to photoshop Screenshot asking where to use the frame

Quick Time to photoshop Screenshot asking another frame

3. iPhoto to Photoshop

This opens the currently selected iPhoto image in Photoshop. It is a simple automation leap that gets you where you want without intervening steps.

iPhoto to Photoshop
Type: Simple Script
Requirements: Adobe Photoshop CS4

iPhoto to Photoshop Screenshot

4. Rampage

Drop an image file or a folder with image files in Rampage, and you get a text file with a lot of information about the file(s): size, resolution, color mode, ICC Profiles and more. It also reports warnings and errors about the file(s). The script currently supports TIFF, GIF, BMP, PNG and JPG image formats.

Rampage
Type: Droplet
Requirements: None

Rampage Screenshot on dropping

Rampage Screenshot with report file

5. SWF Extractor

This extract SWF files from Flash projectors (Windows or Mac executables) that are dropped into it.

SWF Extractor
Type: Droplet
Requirements: None

SWF extractor Screenshot on dropping

SWF extractor Screenshot on result

Safari Tools

6. Safari Web Site Validator

Safari Web Site Validator gets the HTML or XHTML from the current active Safari tab and sends the code to the W3C Markup Validation Service in a separate window. It then asks if you want to validate the page’s CSS file as well.

Safari Web Site Validator
Type: Simple Scripts
Requirements: OS X 10.4.4+

Safari Validator screenshot on asking for CSS

Safari Validator screenshot on the validation report

7. Tiny URL

Despite its name, the Tiny URL script doesn’t use the TinyUrl application. It’s based on another URL shortening service called Metamark. It goes to the currently active Safari tab and puts the shortened URL directly in your clipboard.

Tiny URL
Type: Simple Scripts
Requirements: None

Tiny URL Screenshot with shortened url

8. Safari Cleannup

This automates the deletion of Safari icons and cache and plist files. Getting rid of these extraneous files can boost Safari’s performance.

Safari Cleannup
Type: Simple Scripts
Requirements: None

Safari Cleannup Screenshot on asking for options

9. Scour Web Page

This script scans the current Web page in Safari looking for MP3, AAC and PDF media files. If it finds multiple files, it prompts you to select the ones you want to keep, and then downloads them and adds them to your iTunes media library.

Scour Web Page
Type: Simple Scripts
Requirements: None

Scour web page screenshot on asking which files to look for

Mail And iCal

10. Fuhgeddaboutit

In Sopranos-speak, fuhgeddaboutit means “forget about it.” Indeed, one of the purposes of GTD is to free your brain from having to keep track of everything. Just relax, forget about it now and be confident that you’ll remember when you need to.

This script make that possible by making iCal To-Do items from an Apple Mail email. Just invoke the script with the email you want, and it will create an iCal item with a due time set relative to the email’s arrival.

Fuhgeddaboutit
Type: Simple Scripts
Requirements: None

Fuhgeddaboutit screenshot on aking which calendar to use

Fuhgeddaboutit asking for a due date

11. Send Attachment Droplet

Just drop a file into this Droplet, and it will make a new Mail email with the file as an attachment and the subject set to the file’s name. If the Mail app is closed, the script will open it for you.

Send Attatchment Droplet
Type: Droplet
Requirements: None

send attachment screenshot on dropping

send attachment screenshot on the created email

12. Remove iCal Duplicates

When you sync and share many calendars in iCal, you often end up with a lot of duplicates. This simple script helps you remove those. But once you ask it to delete duplicates, there’s no undoing. So, be sure to back up your calendar first.

Remove iCal Duplicates
Type: Simple Script
Requirements: None

Remove iCal Duplicates on which calendar to choose

Remove iCal Duplicates on the result of the removal

13. iCalculate

Invoke this script, create an iCal calendar item and start date, and it will generate a text file reporting how many hours you have worked on the project. It even calculates the total cost of the project, based on the hourly rate your specify. Especially suited to freelancers.

iCalculate
Type: Simple Script
Requirements: None

iCalculate screenshot on prompt for start date

iCalculate screenshot on the generated report

Finder Utilities

14. Pack’em

Pack’em takes one or more items from Finder, packs them with tar, compresses them with either bzip2 or gzip and saves the compressed archive in the same folder as the original items. A great companion to the Send Attachment Droplet. With these two AppleScripts, you can compress and email a set of files or folders directly from Finder.

Pack’em
Type: Simple Script
Requirements: None

Pack'em screenshot on choosing the compression format

Pack'em screenshot on the result of packing

15. Rename Files

Just drop a folder into this Droplet, and it will give you a lot of options to batch process its contents. You can rename the files according to names specified in a particular text file or change the files individually. Either way accomplishes your task much faster than by changing every file name independently.

Rename Files
Type: Droplet
Requirements: None

Rename Files screenshot on dropping

Rename Files screenshot on first level script options

Rename Files screenshot on second level script options

Rename Files screenshot on third level script options

16. Websafe Name

If you develop websites, you are probably accustomed to giving your files Web-friendly names. But there are times when you have to upload a whole set of files sent to you by a client, or upload things that you weren’t expecting to use. Websafe Name is very useful for this kind of task. You don’t even need to look through the list of files; just drop them into this script, and it will rename them to something Web-friendly.

Websafe Name
Type: Droplet
Requirements: None

Web safe name screenshot on dropping

Web safe name screenshot on the resulting file

17. Tagger

The “folder” is a computer interface paradigm that is a very powerful way to organize files. But it’s neither the only paradigm nor the best solution for all scenarios. Many sub-folders nested deep is a sign that a folder structure may not be appropriate. Another great paradigm, coming straight from the Web, is “tagging.” You keep all your files flat in a common location, but group them by tags so that you can retrieve or filter them by tags. It so happens that the Mac OS X has very good support for this. You can use Spotlight Comments to tag files and Smart Folders to dynamically retrieve them. All you need now is an easy way to do this, and this Folder Action does exactly that.

To use Tagger, attach it to a folder. Then, every time you add a file to that folder via Finder, the script will prompt you to tag that file. It also automatically creates Smart Folders for all of your defined tags.

Tagger
Type: Folder Action
Requirements: None

Tagger screenshot on prompt for tag name

Tagger screenshot on the generated smart folder

Further Resources

If you like the scripts above, you may also be interested in the following articles and related resources:

Should Smashing Magazine publish more Mac-related posts?

Please let us know in the poll below and in the comments to this post!


(al)

↑ Back to top

Diogo Terror is a web developer that is passionate about good design, whether that's in the graphic sense or in the computer science sense.

  1. 1

    OMFG! I love when life becomes easier, but making it easier even on a Mac is something to shout out loud OMFG!

    0
  2. 2

    Pertamax! Good article..i’m mac user. Salam !!

    -1
  3. 3

    Yay! Apple goodies!

    2
  4. 4

    Macs and our industry go hand in hand. GREAT list of simple things to make life easier. More Mac tuts, please!

    0
  5. 5

    Send Attachment Droplet is unneeded, you can just drag the file onto Mail.app and it does the same thing…

    0
  6. 6

    Keep the Mac tips coming. These are great.

    0
  7. 7

    Courtny Cotten

    May 22, 2009 5:50 am

    I don’t know if SM should focus on Mac related tips only… Although I love my Macs, I also do a lot of work on Windows as well and think that the two go hand in hand in the development world.
    Don’t box yourself in SM!

    -1
  8. 8

    This is great, thanks, extremely useful! Why are you still using Tiger (Mac OS 10.4.*), though?

    0
  9. 9

    Yes more Mac posts please. I for one would like a breakdown of the pros and cons of different methods for getting IE to run on a Mac for testing (VMWare, VirtualBox, Darwine, etc).

    0
  10. 10

    hmm, i don’t believe these applescripts are very useful… i found nothing in the list which i could use productive…

    but i would appreciate more mac related articles!

    0
  11. 11

    Great Collection, thank you.

    0
  12. 12

    Macs are for designers who dont want to take their skills to the next level. Lets get back to the top level stuff guys!

    -5
  13. 13

    Sounds Good… finally SM also giving advice related to MAC. Looking forward to see more articles like these.

    DKumar M.
    @instantshift

    0
  14. 14

    I wish I would have seen this last year. I’ve replicated much of this stuff using Automator. Don’t forget about Automator World!

    0
  15. 15

    Dear Smashing Magazine,
    Thank you for this one, great content!

    0
  16. 16

    An Applescript that detects when folders are added to a specific directory & then prompts iTunes to add those new folders to the library would be amazing. I don’t know if this is possible, but it sounds like it should be.

    0
  17. 17

    Floris Fiedeldij Dop

    May 22, 2009 7:36 am

    This stuff is great, keep it (Mac) coming.

    0
  18. 18

    For #11, the mail attachment droplet — you can just drag a file onto the Mail icon (in the Dock or elsewhere) and it will open a new blank message with the file as an attachment.

    0
  19. 19

    Fascinating!

    0
  20. 20

    Wow! Thanks for posting these scripts! Very, very useful! :)

    0
  21. 21

    “Macs are for designers who dont want to take their skills to the next level.” William – how do you figure that? youre out of your mind

    0
  22. 22

    Pete Skenandore

    May 22, 2009 10:03 am

    Whoohoo! #3

    0
  23. 23

    i do not have a MAC. sgrunt! :-(

    0
  24. 24

    @ #2 : some of ‘famous local forum’ user ? :) nice…
    anyway… easy life afterall… iEasy, newest mac’s product…

    0
  25. 25

    What about Windows Vista ?

    0
  26. 26

    This is SUCH a good article. Thank you so much!

    0
  27. 27

    The Fuhgeddaboutit script doesn’t work in Leopard…

    0
  28. 28

    Amazing timing, I was recently experimenting with apple script. Thanks for the round up!

    0
  29. 29

    Never knew such features exist! Quick and easy the way a mac should be.

    0
  30. 30

    As the creator of “ConvertImage” I was very happy to see you mention the script! As so often happens, I wrote the script for myself, then realized others might use it too and wrote a tutorial.
    For more on working with images, see my follow-up article @ Macscripter about writing this script using Automator instead of Applescript.

    0
  31. 31

    I once read of script that would recreate a set of empty nested folders, like for a projects that always have the same or similar folders but different files, for example: client in, client out, contractor in, contractor out et al.

    Does anyone know this script?

    0
  32. 32

    Thanks Im Bookmarking this

    0
  33. 33

    Greatcreativelinks.com

    May 23, 2009 1:42 am

    woha! never used AppleScripts before – Awesome!

    0
  34. 34

    thx, very useful post :)

    0
  35. 35

    Wait, they live in the “Finder’s toolbar”? The Finder doesn’t have a “toolbar” PCs have a toolbar, not Macs.

    0
  36. 36

    Hmmm… my ~Library/Scripts folder doesn’t have an Applications folder in it. So I created one, and created sub folders for these (safari, quicktime, iphoto) but the scripts don’t show in the menubar scripts menu.

    In fact, even though I clicked “show application scripts on top” I can’t seem to get those to show (per the example image) for ANY application, including the default ones (addressbook, iChat, etc).

    ???

    0
  37. 37

    Super Stuff

    0
  38. 38

    The Designer Geek

    May 23, 2009 8:31 am

    more good free scripts here

    0
  39. 39

    >Wait, they live in the “Finder’s toolbar”? The Finder doesn’t have a “toolbar” PCs have a toolbar, not Macs.<

    The Mac OS most certainly does have a toolbar, which is why the command “Customize Toolbar” exists in the Finder.

    0
  40. 40

    This is a great post. Lots of depth and informative stuff here…

    0
  41. 41

    errr automator?

    0
  42. 42

    Hmm, only some of them were useful for me. Good collection, though.

    @Roby S Oh, no, a Kaskus user.

    0
  43. 43

    Wow thanks for the Fuhgeddaboutit mention.

    This script hasn’t been worked on since 06, but I am glad to see it still has a life. I use it in a scheduling workflow I have for my illustration work.

    @Rasmus and others. Fuhgeddaboutit doesn’t function as it was originally intended. Apple took away the control key functionality for scripts on the 10.3.8 update, however you can still use the script. Simply move the script to the Library–>Scripts–>Mail Scripts directory. Then highlight (select) the email, and go to the scripts Menu Item and select Fuhgeddaboutit and it’ll run for you.
    You could probably even tie this into a Quicksilver action to get the control key functionality back into play or set up a Rule in Mail that called Fuhgeddaboutit into action.

    If you have any other probs, or projects please do not hesitate to contact me:
    damon at solutionarts.net

    0
  44. 44

    I really like what you did…thanks for the info

    0
  45. 45

    scriptbuilders.net is down. Any word on when it will get back up? This is a fabulous list of scripts and I really want to get my hands on some of them!

    1
  46. 46

    Thanks for this excellent information! A couple of these will come in handy! I need to find a script for my Apple Mail Rules when I turn my Out-of-Office message on. It replies to every email… I want it to reply only once per person. I accidentally replied to an email from my iPad (and it sends a copy to my email) so the Out-of-Office message kept sending it back and forth to me because it didn’t know when to stop! I had 80+ messages to myself in just over an hour! I’ll check out the resources you mentioned but one of them is down so I’ll keep checking… Thanks again!

    0
  47. 47

    Applescript can be triggered by your proximity to your computer using the Geohopper app in the Mac and iOS app stores. Makes for some interesting possibilities.

    0
  48. 48

    Help… How can I change the default screenshot name, to whatever I have written on Preview search tool at the time of the screenshot. As a function on terminal or as a script. Using OS X Mavericks. Thanks in advance

    0

↑ Back to top