Ben Waldie

Engadget Editorial Policies

The unique content on Engadget is a result of skilled collaboration between writers and editors with broad journalistic, academic, and practical expertise.

In pursuit of our mission to provide accurate and ethical coverage, the Engadget editorial team consistently fact-checks and reviews site content to provide readers with an informative, entertaining, and engaging experience. Click here for more information on our editorial process.

Stories By Ben Waldie

  • Adding copy-to-clipboard rollovers in Contacts app via AppleScript

    Apple's Contacts app includes a lot of great shortcuts for initiating different forms of communication. Just click an email address, phone number or URL field label to display a list of available options. You can send an email, show a phone number in large type or start a FaceTime call, for example. Curiously, one shortcut that's absent from most of these popups is one for copying the email address, phone number, URL, etc. to the clipboard. Mailing addresses are one exception, as they provide an option to copy a mailing label. But, other fields don't include this option. Sure, you could just select a phone number, email address, URL, etc., and press Command+C to copy it. But, what fun is that? It sure would be nice if there were just more handy copy-to-clipboard shortcuts instead. With the help of AppleScript, you can add your own. Here's how... Writing the Script The following steps demonstrate how to add a Copy to Clipboard shortcut to phone number fields in the Contacts app. If you have any trouble following along, you can download the complete script here, along with ones for email address and URL fields too. 1. Launch AppleScript Editor (in /Applications/Utilities) 2. Create a new script document and enter the following code: Note: If you want to create a version of this script for email address or URL fields, just change the action property handler to return the appropriate field type, i.e., on action property return "email" end action property or... on action property return "url" end action property Installing and Using the Script In order for the script you created to appear in the Contacts app, it needs to be saved in the proper place. 1. Quit Contacts if it's running. 2. Save the script you created as Contacts > Copy Phone to Clipboard.scpt, in script format, into the ~/Library/Address Book Plug-Ins folder in your Home directory. If this folder doesn't already exist, go ahead and create it. Now, just relaunch the Contacts app. When you click on a phone number field label, you should see a new option for copying the phone number to the clipboard. Now, repeat the steps above for email addresses and URLs to enhance the Contacts app even further. This marks my last scheduled post for the TUAW for a bit. Hopefully, you'll see more of me here in the future. In the meantime, feel free to reach out to me on Twitter to say "Hello," ask a scripting question or two, suggest a future topic, etc. Until next time, Happy Scripting!

    By Ben Waldie Read More
  • Extract App Resource Icons with AppleScript

    Whether I'm preparing for a demo or writing an article, blog post, book, or technical documentation, I often find myself performing the same set of repetitive steps. I need to navigate into an app's packaged resources folder, find one or more icon files, occasionally convert them to PNG and scale them, and add them to my document, Keynote presentation, etc. Fortunately, this doesn't need to be a manual process each time, thanks to the following AppleScript. Creating the Script 1. Launch AppleScript Editor (in /Applications/Utilities) and create a new script document. 2. Enter the following script into the document. NOTE: If you have any trouble following along, you can download the completed script here. 3. Run the script from AppleScript Editor, save it as an app, or add it to your script menu. Running the Script When you run the script, you're first asked to select an app from which to extract icons. Make your selection and click Choose. The script looks inside the app's /Contents/Resources folder for any files with an extension of .icns. If multiple files are found, it allows you to select the ones you want to extract. The default is all of them. Next, the script gives you the option to extract the .icns files themselves, or PNG versions. Click the button to make your choice. If you click the PNG button, then you're given a choice of sizes to create. You might not need the full sized icons, for example. You might only need 256x256 icons. Depending on the options you chose, the script extracts the .icns files, or it converts the .icns files to PNG and scales them, as needed. You're notified when the icons have been extracted, and they're displayed in the Finder for you. Now you can simply drag them to your document, presentation, file, etc., and you're good to go! Happy Scripting!

    By Ben Waldie Read More
  • AppleScripting OmniFocus > Send completed task report to Evernote 2

    In February, I provided instructions for using AppleScript to send completed task reports from OmniFocus to Evernote. The script was quite well-received by readers, and I've had numerous requests for enhancements. This post provides an updated version of the script, which includes a number of additions. The script now supports full project paths and additional task details including the context, estimated time, start date, modification date, completion date and notes. This additional content is optional, and you can adjust the script to not display it if you wish. Creating the Script NOTE: You can download my completed script here. 1. Launch AppleScript Editor (in /Applications/Utilities) 2. Create a new script document and enter the following code: 3. At the top of the script, you can adjust various properties to customize the information that's displayed in the report. Just change any of these property values to false to prevent them from appearing. Running the Script You can run the script right from within AppleScript Editor. Or, you can save it and run it from your system-wide script menu, your Dock or wherever else you'd like. When the script runs, just specify the date range you want to include. The script then creates a report for any tasks completed within that specified range in your Evernote Inbox. Now, you can quickly generate much more detailed reports of your recently completed OmniFocus activity simply by running the script. Happy Scripting!

    By Ben Waldie Read More
  • AppleScripting Email > Developing a Quoted Reply Service

    A reader recently wrote to me with a problem. Apparently, Microsoft Outlook no longer contains the ability to create quote level chunks of text when replying to messages in plain text format. Why this functionality was removed, I can't say. But, with a little help from AppleScript and Automator, I was able to help the reader to add this functionality back via a Service. Better yet, the Service can be set up to work in any email client, or even system-wide in any app. Here's how you can do it... Building the Service 1. Launch Automator (in /Applications) and create a new Service workflow. Creating a Service workflow in Automator 2. Configure the workflow (at the top) to process selected text in any application, or your favorite email client, such as Mail or Outlook. Then, select the "Output replaces selected text" checkbox. In this screenshot, the Service is set to appear only in the Outlook app. 3. Find and add the Run AppleScript action to the workflow. It should link up with the header, indicating that it receives text as input. Enter the following script into the action. Note: If you get stuck, you can download the completed script and workflow here. Example of the completed workflow 4. The script above is set to limit lines to a maximum of 42 characters. If you want longer lines, go ahead and adjust this in the script. Just set the theMaxLineLength variable to the desired length. Also, note that this is a guideline. The script tries not to break words in the middle. So, if an extra long word is encountered, you may still have lines longer than the maximum length. 5. Save the workflow as Email > Quote Selected Text. Automator puts it where it needs to go. Saving the Service workflow Using the Service Now, anytime you're in your email app and want to create quoted text in a plain text message, just select the desired text. Right-click it (or Option+Click it) to display the contextual menu. Then, select Services > Email > Quote Selected Text. Again, this is intended for plain text messages. It will probably generate inconsistent results with HTML formatted text. Triggering the workflow from the Services contextual menu in Outlook to process selected text in a message If you don't see the Services menu in the contextual menu, then whatever app you're using may not support contextual Services. In this case, try triggering the workflow from the App > Services menu instead. Triggering the workflow from the Application > Services menu If all goes well, your selected text is passed to the Service workflow, and the processed quoted text is inserted. Happy Scripting! A message containing processed text

    By Ben Waldie Read More
  • AppleScripting Microsoft Outlook > Announce New Emails By Voice

    In my last post, I demonstrated how to write an AppleScript that verbally announces when new emails arrive in Mail. Some readers asked whether the same thing could be accomplished with Microsoft Outlook. It certainly can. Here's how... Creating and Installing the Script 1. Launch AppleScript Editor (in /Applications/Utilities) and create a new script document. 2. Enter the following script into the document. NOTE: If you have any trouble following along, you can download the completed script here. NOTE: This script was written and tested with Microsoft Outlook 2011, version 14.3.2, running in OS X 10.8.3, Mountain Lion. You can test the script by running it in AppleScript Editor. Select a message or two in Outlook. Then, return to AppleScript Editor and click Run in the script document's window. 3. Make any adjustments to the properties at the top of the script to customize its behavior. For example, if you don't want the script to raise your volume if it's too low, change the raiseVolumeIfNeeded property value to false. If you don't want the script to read the first few paragraphs of each message to you, set the readFirstParagraphsOfEachMessage property value to false. Modifiable Properties in the Script 4. Save the script in Script format to your Desktop as Outlook > Announce New Emails By Voice.scpt. Saving the script to the Desktop 5. Launch Outlook. From its script menu, choose About This Menu... In the dialog that appears, click Open Folder. This opens the Outlook Script Menu Items folder, which is either in your ~Documents/Microsoft User Data folder or your ~/Library/Application Support/Microsoft/Office folder, depending on the version of Office you have installed. The Microsoft Outlook Script Menu Click the Open Folder button to display the Outlook Script Menu Items folder. 6. Move the Outlook > Announce New Emails By Voice.scpt file from your desktop into the Outlook Script Menu Items folder. The Outlook Script Menu Items folder may contain some default scripts provided by Microsoft. Adding an Email Rule Now that you've installed the script, you can run it from the script menu in Outlook. But, you really want a script like this to run automatically when new emails arrive. So, you need to configure a rule to do this. 1. Select Tools > Rules... to display the Rules window. Outlook's Rules window 2. Click the appropriate type of account, i.e. Exchange, IMAP, POP, and click the + button to create a new rule. 3. Name the rule Announce New Emails By Voice and set it to trigger on All Messages. Set the rule's action to Run AppleScript. Click the Script... button and choose your saved script in the Outlook Script Menu Items folder. Click OK to close the rule. The configured rule, set to run your script Now, whenever a new email arrives for the specified type of account, the rule should trigger your script to announce the new messages. If you want to disable the announcements at any time, just go back to the Rules window and de-select the Enabled checkbox next to the rule. Happy scripting! You can disable the announcement script in the Rules window whenever you want

    By Ben Waldie Read More
  • AppleScripting Mail > Announce New Emails By Voice

    You're in the kitchen cooking dinner, or sitting down watching TV, or exercising. Ding! You have a new email. Quickly, run to your Mac to see who it's from. Meh, spam. Ding! Meh, a message from your boss. Ding! Meh. Sure would be nice if Mail could announce who's emailing you. That way, you could just listen for ones you care about. Well, with the help of AppleScript and Mail rules, you can set this up on your own. Think of it as an audible caller ID, but for email. Setting It Up 1. Launch AppleScript Editor (in /Applications/Utilities) and create a new script document. 2. Enter the following script into the document. NOTE: if you have any trouble following along, you can download the completed script here. NOTE: If you wish to test the script, which is always a good idea, you can do so by running it in AppleScript Editor. Just select a message or two in Mail. Then, return to AppleScript Editor and click Run in the script document's window. 3. Make any adjustments to the properties at the top of the script to customize its behavior. For example, if you don't want the script to raise your volume if it's too low, change the raiseVolumeIfNeeded property value to false. If you don't want the script to read the first few paragraphs of each message to you, set the readFirstParagraphsOfEachMessage property value to false. Modifiable Properties in the Script 4. Save the script in Script format to your Desktop as Mail > Announce New Emails By Voice.scpt. Saving the script to the Desktop 5. Launch Mail, open its Preferences window, and click Rules in the toolbar. Mail's Rule Preferences window 6. Click Add Rule to create a Mail rule. 7. Set the rule's description to Announce New Emails by Voice. 8. Set the rule to trigger if any of the following conditions are met: Account matches [Your Account]. If you have multiple accounts, click + and add each one. 9. Set the rule to perform the following action: Run AppleScript. From the list of scripts, choose Open in Finder. Configuring the Mail rule 10. Copy the Announce New Emails By Voice.scpt script file from your desktop into the newly opened folder (this folder is ~/Library/Application Scripts/com.apple.mail in Mountain Lion). Mail's rule scripts folder in Mountain Lion (in ~/Library/Application Scripts) 11. Go back to Mail and close and save the rule. The configured Mail rule, set to run the script Now, whenever a new message arrives for the accounts you specified, the rule should trigger the script, and the messages should be announced audibly. If you get tired of listening to the announcements or want to mute them, just open up Mail's Preferences > Rules window again and de-select the Active checkbox next to the rule. Happy Scripting! You can disable the Mail rule by de-selecting the Action checkbox

    By Ben Waldie Read More
  • Triggering AppleScripts from Calendar Alerts in Mountain Lion

    AppleScripts are great tools for increasing your daily productivity. They're even better when they can be set to run unattended, at night, on weekends or during downtime. In Lion, iCal included a handy option for attaching a script to a calendar event. Just create an event, add a Run Script alarm, point it to the desired script and you're good to go. Things changed in Mountain Lion, though. Presumably for security reasons, the Run Script alarm option was removed from the Calendar app. Despite its removal, however, there are still some ways you can trigger scripts from Calendar events. iCal event alarm choices in OS X 10.7 Lion Calendar event alarm choices in OS X 10.8 Mountain Lion Use Automator to Trigger Your AppleScript Although Apple removed the Run Script alarm option in the Calendar app, Automator's ability to save Calendar Alarm workflows wasn't removed. And, since Automator workflows can trigger AppleScripts, they offer a quick and easy workaround for scheduling scripts. Start by launching Automator and creating a new Calendar Alarm workflow. To schedule an Automator workflow, choose the Calendar Alarm template. To Trigger an AppleScript App If your script is an app, you just need to set the workflow to launch it. Add the Launch Application action to the workflow. From the application popup menu, choose Other... and navigate to your saved AppleScript app. The Launch Application action can be used to launch an AppleScript app. To Trigger AppleScript Code If you'd rather not create an app (an app + your Automator workflow means more files to manage), you can embed compiled AppleScript code right within your workflow. Find the Run AppleScript action and drag it to the workflow. Then, insert the desired script code into the action. The Run AppleScript action can be set to run code embedded in your Automator workflow. To Schedule the Script Once you've got your workflow configured, go ahead and save it. Automator automatically adds it to an Automator calendar (which is created if it doesn't exist yet) in the Calendars app. An Open File alarm is added to the event and set to run the workflow. Now, adjust the start date of the event as needed, put it on a repeating schedule, etc. Open File alarms are used to trigger Automator Calendar Alarm workflows. Use AppleScript to Create a Scheduled Event If you create an event in the Calendars app and add an Open File alarm, you should find that you're unable to select a saved AppleScript app. You can select a compiled AppleScript file, but this is essentially useless because when the event triggers, the Open File alarm simply causes the compiled script to open in AppleScript editor. Not what you need. What you really need is to open a saved script app. AppleScript to the rescue. To work around the limitation, just run the following script. It asks you to select a saved AppleScript app. It then creates an event at the current date and time on an AppleScripts calendar, which it creates if it doesn't exist already. The script then adds an Open File alarm to the newly created event and sets it to open your selected script app. Yep, that's right. Although you can't manually set an event to open a saved AppleScript app, you can script the process. NOTE: You can download the complete script below here. So, there you go. A number of workarounds for triggering scripts from Calendar events in Mountain Lion. So, schedule away! Happy Scripting!

    By Ben Waldie Read More
  • More Tips for Troubleshooting Automator Workflows

    In my last post, I shared some useful tips for troubleshooting Automator workflow problems. I didn't cover everything, though. There are lots of other ways you can troubleshoot your workflow. Here are some more tips to help. 1. Use Get Selected Finder Items Wisely Automator workflows are frequently created to process files and folders. When you save a workflow as an application, you can drag files and folders onto it and they're passed right into the workflow for processing. Other types of workflows behave similarly. Save a Folder Action workflow, for example, and every time new items are added to the folder, they're automatically passed to the workflow for processing. At the top of a workflow, Automator tells you if it receives files and folders as input. From time to time, however, you may notice that your workflow has processed your files twice, or that it's encountered some kind of obscure error. Often, this is due to the presence of a Get Selected Finder Items action at the beginning of the workflow. As enticing as its name sounds, the Get Selected Finder Items action isn't always needed to process files and folders. Remember, depending on the type of workflow you built, those items may be passed automatically to your workflow. In these cases, the inclusion of the Get Selected Finder Items action causes the dropped items to be appended to themselves. This can result in the items being processed twice or an error. So, what's the solution? Just try removing the Get Selected Finder Items action from the beginning of your workflow. Many times, that one simple change fixes the problem. Don't insert the Get Selected Finder Items action at the start of a workflow if your workflow already receives Finder items as input. 2. Finding Missing Output Files Imagine this. You run an Automator workflow that takes a PDF and outputs its pages as images. The only problem is that the images never seem to show up. Sound familiar? If you've ever been unable to find files output by a workflow, it may not necessarily mean that your workflow failed. Those files may actually be buried somewhere on your system. This is because some Automator actions generate their output files in hidden temporary folders. The Render PDF Pages as Images action is one example. It extracts the pages of a PDF as image files, gives them unique names, and saves them into a hidden temp folder. Render PDF Pages as Images sneakily outputs files to a hidden folder. Note that it doesn't have an option to select an output folder. To determine whether this has happened, run your workflow in Automator. Then, open the action's Results area. If there are files or folders listed, you should be able to figure out where they're located by viewing them in list view. An action's Results area tells you if an action really produced a result. To output the files or folders to the desired location, just insert a Move Finder Items action into your workflow. This should move the items from their secret location to the Desktop or wherever else you choose. Use the Move Finder Items action to move hidden output files someplace more useful. 3. Improving Recorded Task Playback A great feature of Automator is its ability to record things you do manually, so you can play them back later as part of your workflow. A not so great feature of Automator is its knack for being unable to play back what it records. There are a number of reasons this can happen, and some options for fixing things. You may have made a mistake while recording. Remember, Automator is watching. So, it picks up your mistakes too. If this happens, try selecting the extra steps in the Watch Me Do action Automator adds to the workflow. Then, press the Delete key to remove them. You can remove recorded steps by selecting and deleting them. You may have moved too fast, and Automator couldn't keep up. It may have missed some of what you did. You can try to resolve the problem by recording the steps again. This time, take your sweet time. Automator may be unable to repeat what you did manually. Unfortunately, Automator can't access everything in OS X. It can access a lot, but not everything. If this happened, consider trying a third-party macro utility, such as iKey. It may have greater reach than Automator. 4. Locating Missing Actions If you've ever launched Automator but have been unable to locate an action that you used in the past, it may not mean that action is entirely gone from your Mac. Automator may just be unable to load it for some reason. For example, maybe the app the action works with isn't installed anymore. You can see what Automator is unable to load by checking the Console app (in /Applications/Utilities). Just open it up, launch Automator, and see what shows up in the Console. The Console app tells you what actions Automator can't load. Here, the Entourage actions weren't loaded because I don't have Entourage installed anymore. I now have Outlook installed. 5. Service Workflows Not Triggering? Have you created service workflows, but when you trigger them, they don't seem to run? Give them some time. For whatever reason, they may take some time to get going. After one has run, however, subsequent service workflows should run a bit faster. You may have also noticed that you can assign keyboard shortcuts to Service workflows. If you haven't noticed this, you can do it in System Preferences > Keyboard > Keyboard Shortcuts. Assigning a keyboard shortcut to a Service workflow Once you've assigned a keyboard shortcut, you may have found that the workflow doesn't run when you press the keyboard shortcut. One possible fix is to manually choose the workflow from the application's Services menu. Then, once it's been triggered for the first time, the keyboard shortcut often starts working again. Hopefully, these tips and my prior tips have put you on the path to more stable and reliable workflows. Good luck and Happy Scripting!

    By Ben Waldie Read More
  • Tips for Troubleshooting Automator Workflows

    Automator's great for streamlining time consuming and repetitive tasks on your Mac. It's easy. Just launch it, find a few actions, and string them together to form a workflow. Then, run your workflow anytime you want to perform that series of tasks again. What happens if your workflow doesn't run as you expect, though? Finding and solving problems in Automator is often easier said than done. Suddenly, the simple tool that's supposed to make your life easier has become a real pain in the neck. This week's post covers some things you can do to troubleshoot a finicky Automator workflow, track down the problem, and hopefully solve it, so you can get back to work. 1. Run Saved Workflows in Automator Automator workflows are saved and run in a variety of ways - as apps, iCal alarms, print plugins, and more. When a saved workflow encounters a problem, however, it may be next to impossible to figure out what went wrong. This is because saved workflows don't really include any diagnostic tools. In some cases, the workflow may even fail silently, without alerting you that something is wrong. Your only indication of a problem may be a lack of the end result you were expecting. Not very helpful, especially in a longer multi-action workflow. When you encounter a problem with a saved workflow, your best bet is to open up the workflow in Automator, and try running it there. By doing so, you'll gain access to some of the techniques described below. 2. Fake Workflow Input When you run a workflow app or plugin within Automator, you may see an alert indicating that the workflow will not receive input. An Automator Input Alert for a Text Service Workflow This is because, often, saved Automator workflows expect input for processing. For example, a workflow app may expect dropped files or folders as input, a service workflow may expect text as input, or a print plugin may expect PDF files from the print system. In any case, just dismiss the alert and add an action to the beginning of the workflow to retrieve the required type of input. If your workflow processes files, for example, add a Get Specified Finder Items action. If your workflow processes text, add a Get Specified Text action. Whatever you add, just be sure to remove it once you're finished troubleshooting. Get Specified Text at the Beginning of a Text Service Workflow 3. Check Action Results Automator works by passing information to actions for processing. Most actions perform a very specific function. As such, they accept specific types of information as input. And, they produce different types of output. The New TextEdit Document action, for example, wants text as input. It then adds this text to a new TextEdit document, and passes the document as output for further processing. Often, when a workflow fails or produces an undesired result, it's because actions aren't receiving or producing the expected types of information. To diagnose this problem, click the Results button beneath each action in your workflow. Then, when you run the workflow, you can see exactly what information is being passed from action to action. Suppose, for example, I have a workflow that should take the contents of a text file and add it to a new TextEdit document. I may try creating my workflow with the following actions: Get Specified Finder Items - Configured to get a text file Filter Paragraphs - Configured to look for non-empty paragraphs New TextEdit Document All the actions appear to link up properly, and the workflow may even run without an error. But, the result is not what I want. Rather than the content of the text file being added to the new TextEdit document, the path of the document is added. A Misbehaving Text Workflow An Undesired Workflow Result By displaying the result area of each action in the workflow, I can see that a file path was passed to the Filter Paragraphs action as input. I can also see that the same file path was output by the action, rather than the paragraphs I was expecting. This tells me that there's something wrong with the Filter Paragraphs action. Action Results Indicate Potential Problems Checking the action's description area provides additional clues. It tells me the action expects text as input, not files. Action Descriptions Specify Input and Output Types So, in this case, the fix is to insert an action that outputs text, rather than files, before the Filter Paragraphs action. NOTE: Surprisingly, Automator doesn't include an action for reading text from a file. There are third-party actions available that can do this. Or, as a workaround, you can try using the Combine Text Files action, which receives one or more files as input and outputs their text content. 4. Check Automator's Log Checking the results of an action doesn't always tell you what went wrong. You may glean a little more information by consulting Automator's log area. Press Command+Option+L or choose View > Log to display it. When you run a workflow, the log area tells you which actions ran, and often indicates problems that were encountered along the way, such as an action that wasn't supplied with the appropriate type of input. Automator's Log Area Indicates Successes and Failures Sometimes, the log tells you that information was converted from one type to another. This is because, in some cases, Automator tries to make incompatible actions work together. This doesn't always work, however, and can result in an error. So, be on the lookout for failed conversions. 5. Step Through Workflows Running a workflow and checking action results is great, but it's even more useful to check the results of each step of your workflow as it happens. You can do this by stepping through the workflow step by step. Click the Step button in the workflow's toolbar or select Workflow > Step from the menu bar. Automator's Step Button The above techniques may not resolve every problem you encounter with Automator, but they will certainly help you to more easily identify solutions for some. Happy Scripting!

    By Ben Waldie Read More
  • AppleScript Productivity > Create OmniFocus Followups from Contacts

    As an OmniFocus for Mac user, it's important that I can quickly create tasks at any time, in any app. OmniFocus makes this pretty easy, by providing integration with OS X Mail, a keyboard shortcut for clipping content in apps such as Safari, a system-wide Quick Entry window and a Services menu item. One feature OmniFocus lacks, however, is direct integration with the Contacts app. Suppose I am in Contacts, for example, and I need to schedule a followup phone call or email to one of my clients? Sure, I could bring up the Quick Entry window and enter the task, but I want something a bit more streamlined. I can accomplish just what I need by writing some custom AppleScripts. The following two examples demonstrate how to write AppleScript-based plug-ins for the Contacts app, which add OmniFocus followup options right into the email and phone number popup menus of your contacts. Note: If you have any trouble following along, you can download both of the scripts outlined in this post here. Creating the Email Followup Script Plug-In 1. Quit the Contacts app. 2. Launch AppleScript Editor in /Applications/Utilities and create a new script document. 3. Insert the following code: 4. Save it as a script named Contacts > Email Follow Up with OmniFocus.scpt into the ~/Library/Address Book Plug-Ins folder in your home directory. If this folder doesn't already exist, go ahead and create it. Saving the Script into the Address Book Plug-Ins folder The Address Book Plug-Ins folder in ~/Library Creating an OmniFocus Email Followup Task To give your new plug-in a try, launch the Contacts app and go to a contact. When you hover over the email address field, it becomes highlighted. Click it and choose Follow Up with OmniFocus from the popup menu that appears. The OmniFocus Quick Entry window appears, and it contains an email follow-up task for the contact, including a note with a clickable email link. Creating the Phone Call Followup Script Plug-In The process to create phone call followup plug-in is essentially the same. 1. Quit the Contacts app again. 2. Create another AppleScript Editor document. 3. Insert the following code this time: 4. Save the script as a script named Contacts > Phone Call Follow Up with OmniFocus.scpt into the ~/Library/Address Book Plug-Ins folder in your home directory. Creating an OmniFocus Phone Call Followup Task Launch the Contacts app again. This time, click on a contact's phone number field and choose Follow Up with OmniFocus from the popup menu. Again, OmniFocus' Quick Entry window is displayed. This time, it contains a phone call follow-up task and a note containing the phone number. Voila, you now have quick OmniFocus integration with Contacts, and you can use it anytime you need to schedule a follow-up. Until next time, Happy Scripting!

    By Ben Waldie Read More
  • AppleScripting OmniFocus > Send Completed Task Report to Evernote

    I've mentioned before that OmniFocus is my task manager of choice. Each morning, I pull up a list of scheduled tasks for the day, and focus on getting them done. In OmniFocus, I've set up Perspectives (saved window states) for both Due tasks and Completed tasks. What I really want, however, is something that will pull out recently completed tasks and summarize them in Evernote, my note management app of choice. This way, I can maintain a historical log of my progress, and pull out summaries of completed tasks to send to clients. Since this type of integration isn't built into OmniFocus or Evernote, I wrote an AppleScript to do it. Creating the Script NOTE: If you have any trouble following along, you can download my completed script here. 1. Launch AppleScript Editor (in /Applications/Utilities) 2. If your system-wide script menu isn't enabled already, go into AppleScript Editor's preferences window and turn it on. 3. Create a new script document and enter the following code: 4. Bring OmniFocus to the front, and from the system-wide script menu, choose Open Scripts Folder > Open OmniFocus Scripts Folder. This creates the following folder, if it doesn't already exist -- ~/Library/Scripts/Applications/OmniFocus 5. Go back to AppleScript Editor and save the script as OmniFocus > Prepare Task Completion Report into the ~/Library/Scripts/Applications/OmniFocus folder you opened in the last step. Running the Script Bring OmniFocus to the front. Next, select OmniFocus > Prepare Task Completion Report from the script menu. The script starts by asking for the scope of the report. Your options are to summarize tasks from today, yesterday, this week, last week or this month. Choose one, and click OK. Next, the script retrieves a list of tasks within the specified timeframe, formats them as HTML, brings Evernote to the front, and creates a new note. You've now got a summary of recently completed tasks in Evernote. Do you feel productive yet? Until next time, happy scripting!

    By Ben Waldie Read More
  • AppleScripting Dates > Elapsed Time Calculator

    Since Valentine's Day is this week, I thought I would take this opportunity to share an AppleScript I wrote to calculate how long my wife and I have been married. With this baby, I'll never be accused of forgetting how long it's been when our anniversary rolls around. The script determines the elapsed time between now (the current date and time), and a prior date and time (such as our anniversary). It then displays the result in seconds, minutes, hours, days, weeks, months and years. Note: If you're into the whole "traditional anniversary gift" thing (I'm not), you can find a list of gift categories on Wikipedia. Creating the Script Note: If you have any trouble following along, you can download the complete script here. 1. Launch AppleScript Editor in /Applications/Utilities and create a new script document. 2. Insert the following code: Some notes about this script... * I used some of the number calculation handlers in the Essential Subroutines section of macosxautomation.com, although, I made some slight modifications to them for the script. If you're interested in learning more about AppleScript, there are some other useful handlers there, as well, and I encourage you to check them out. * The final display dialog sets as its icon the FavoriteItemsIcon icon file, which is embedded in the CoreTypes bundle in /System/Library/CoreServices. It is, coincidentally enough, a heart. Using the Script To use, just run the script within AppleScript Editor, or save it as an application to be launched and run whenever you wish. First, the script asks you to enter a date and, optionally, a time. Next, the script does its calculations and displays the result. Just take a screenshot of the dialog and send it along to your significant other. Until next time, Happy Scripting and Happy Valentine's Day Week!

    By Ben Waldie Read More
  • AppleScripting Notification Center > Scheduling Do Not Disturb

    Mountain Lion's Notification Center is great for keeping you in the loop, but it can be a huge distraction when you need to get stuff done. Sometimes, a little peace and quiet is all you need to stay productive. As you may know, iOS 6 includes a handy Do Not Disturb feature, which can be turned on to disable notifications. It can even be set to automatically enable/disable itself at scheduled intervals. Mountain Lion also lets you disable Notification Center. Just open Notification Center and drag down to access a Show Alerts and Banners toggle switch. Note that this is a temporary setting, and disabled notifications automatically re-enable at midnight. Unlike iOS 6, though, Mountain Lion doesn't give you an option for enabling/disabling notifications on a schedule. At least, it doesn't provide a built-in option for this. With a little customized help from AppleScript, Automator, and the Calendar app, it is possible. In this post, you'll create two Calendar Alarm Automator workflows, which can be configured to run at scheduled times to enable or disable Notification Center alerts and banners. Note: If you have any trouble following along, you can download the completed AppleScripts and Automator workflows here. Building a Workflow to Enable Do Not Disturb (i.e. Disable Notification Center Alerts and Banners) 1. Launch Automator (in your /Applications folder) and create a new Calendar Alarm workflow. 2. Search the action library for the Run AppleScript action and drag it to the workflow area. 3. Replace the pre-filled AppleScript code in the Run AppleScript action with the following: The script writes to Notification Center's property list file and enables Do Not Disturb mode. It then quits and relaunches Notification Center in order for the change to go into effect. 4. You're finished building the workflow, so go ahead and save it as Enable Do Not Disturb. 5. When you save the workflow, Automator puts it where it needs to go (the ~/Library/Workflows/Applications/Calendar folder). The Calendar app launches and a new event is created in an Automator calendar, which Automator creates if it doesn't already exist. The event should be configured with an Open File alarm that's set to run the workflow. Schedule the event for the desired time, such as every weekday morning at 6 AM. Now, every time the event occurs, the alarm should launch the workflow and Notification Center should be disabled. As I mentioned earlier, Notification Center automatically re-enables each day at midnight. So, if you plan to schedule Do Not Disturb overnight, then you'll need to create an additional event that disables it again at 12:01 AM. Building a Workflow to Disable Do Not Disturb (i.e. Re-Enable Notification Center Alerts and Banners) Now that you've got a workflow to disable Notification Center, you probably want one to re-enable it. 1. Create another new Calendar Alarm workflow in Automator. 2. Search the action library for the Run AppleScript action again and drag it to the workflow area. 3. This time, replace the existing placeholder script in the Run AppleScript action with the following code: This code updates Notification Center's property list file to disable Do Not Disturb. Then, it relaunches Notification Center for the change to take effect. 4. The workflow is done, so save it as Disable Do Not Disturb. 5. The Calendar app should launch again and another event should be added to the Automator calendar. This event should be configured with an Open File alarm that's set to open the Disable Do Not Disturb workflow. Set it to run on the desired schedule, such as every weekday morning at 9 AM. If everything has gone according to plan, you should now have Do Not Disturb workflows that disable and re-enable Notification Center alerts and banners at the desired times. Use your alert-free time wisely. Until next time, happy scripting!

    By Ben Waldie Read More
  • AppleScripting Evernote > Embedded Image Scaler

    I'm a big fan of Evernote. I use it for archiving ideas, writing articles / blog posts and lots more. I often insert screenshots and other large images into my notes. Screenshots can be pretty big, and I usually don't want giant images filling up my notes. I keep wishing Evernote offered a way to resize embedded images, so I could insert thumbnails. At the moment, it doesn't. So, I decided to write my own app to resize embedded images. Here's how you can do the same... Creating the Script App My script app uses Image Events, a background app in OS X, to do the scaling. So, no third-party software (other than Evernote) is needed for this to work. Note: If you have any trouble following along, don't worry, you can download the complete script app here. 1. Launch AppleScript Editor and create a new script document containing the following script: If you're familiar with AppleScript, then you'll notice this script uses an open handler, making it a droplet. When triggered to process an embedded image in an Evernote note, the image is actually passed as if it was dropped on the script app. 2. Save the script as an application named Evernote > Scale Embedded Images to your Applications folder or another folder of your choice. 3. Go to the saved script app and Control+Click on it to reveal the Finder's contextual menu. Choose Show Package Contents to view the contents of the saved app bundle. 4. Navigate to the Contents folder within the script's bundle and open the Info.plist file in TextEdit, TextWrangler or your other favorite text editor. 5. Change the CFBundleDocumentTypes key's array to the following: This Info.plist change sets the script app to only accept JPEGs, PNGs and TIFFs, and for the script app to appear as an image editor. Image Events can process other types of images too, including BMP, GIF, PSD and PICT. So, if you think you may be embedding those types of images in your notes, go ahead and add extensions for them too. 6. Save and close the edited Info.plist. You're done. The script app is ready for use. Resizing Embedded Images in Evernote Please note that your script app scales embedded images in Evernote notes. When an image is scaled, you can't revert back to the unscaled version. So, be pretty darn sure you want to scale an image before triggering the script. 1. Open an Evernote note containing an embedded image. 2. Control+Click on an embedded image and choose Open With. You should see your script app in the list of supported apps. Choose Evernote > Scale Embedded Images. Evernote launches the script app and passes it the selected embedded image. 3. When prompted, choose the desired size. Options are Low (320px on the longest side), Medium (640px) or High (1280px). Or, you can select Custom to enter another size. The script opens the embedded image, scales it accordingly and saves it. Evernote detects that the image has been changed, and updates the note to reflect the new scaled version. Congratulations, you've just expanded Evernote's feature set. Anytime you want a smaller version of an embedded image, your script app is ready to help. Also, while this script is intended for Evernote, you can use it outside of Evernote too. Just drag and drop JPEGs, PNGs or TIFFs onto the script app to scale them too. Until next time, happy scripting!

    By Ben Waldie Read More
  • Mac Productivity > 10 TextExpander Date Snippets

    TextExpander (Smile Software) is a utility I use each and every day on my Mac to save time and increase productivity. One of the things I use it for is formatting and inserting dates and times -- adding the date or time to a file or folder name, into an email, a document and so on. In this post, I've shared some of my most used date and time snippets. I hope you find them as useful as I do. If you're not a TextExpander user, I encourage you to give it a try. You can download a trial version on the Smile Software website. Let me give you a little background on how it works. The concept of TextExpander is simple. You start by creating snippets of text. You then assign abbreviations to those snippets. Whenever you type an abbreviation into any app on your Mac, presto! The corresponding snippet is inserted, replacing the abbreviation you typed. TextExpander also includes some power-user features, such as macros, which let you to insert variable information into your snippets, like dates and times. This is what I'm sharing here -- some of the macros I use for inserting dates. I've provided a brief description of each snippet, as well as the snippet code (the macro), and the abbreviation I use. Feel free to adjust accordingly to meet your own needs. 1. Current Date -- Long: This snippet actually comes with TextExpander as an example. It's used to insert the current date in Month, D, YYYY format, i.e. January 9, 2013. I consider this a long date, and changed the abbreviation, so as not to conflict with my other snippets. Snippet: %B %e, %Y Abbreviation: CDATEL 2. Current Date -- Short: This snippet inserts the current date in YYYY-DD-MM format, i.e. 2013-01-09. This is a good format to use when applying dates to file and folder names, as it allows them to be sorted by year, month and day. Snippet: %Y-%m-%d Abbreviation: CDATES 3. Current Time - Long - This snippet inserts the current time in H:M:SS AM/PM format, i.e. 10:00:00 AM. While this format is good for inserting into emails or documents, it's not so good to use on file or folder names, due to its use of colons. Snippet: %1I:%M:%S %p Abbreviation: CTIMEL 4. Current Time -- Short: This snippet inserts the current time in HH-MM-SS format, i.e. 10-00-00. This is a good format to use when applying times to file and folder names, as it doesn't contain any colons. It also uses 24-hour time, in order to avoid potential file name conflicts. Snippet: %H-%M-%S Abbreviation: CTIMES 5. Month and Year: This snippet inserts the current month and year, in Month YYYY format, i.e. January 2013. I often need to reference the current month in this manner when writing emails. Snippet: %B %Y Abbreviation: MDATE 6. Yesterday: The following snippet subtracts one day from the current date and inserts it in YYYY-MM-DD format, i.e. 2013-01-08. Snippet: %@-1D%Y-%m-%d Abbreviation: YDATE 7. Tomorrow: The following snippet adds one day to the current date, and inserts it in YYYY-MM-DD format, i.e. 2013-01-10. Snippet: %@+1D%Y-%m-%d Abbreviation: TDATE 8. Future Date: The following snippet can be customized to add a specified number of days to the current date, in YYYY-DD-MM format. I have several versions of this snippet for two, three and four days in the future. Snippet: %@+(INSERT NUMBER OF DAYS HERE)D%Y-%m-%dd Abbreviation: FDATE(NUMBER OF DAYS) I.e. For two days in the future: Snippet: %@+2D%Y-%m-%dd Abbreviation: FDATE2 9. Next Sunday: I often need to refer to next Sunday in emails, invoices and so on in YYYY-MM-DD format. This goes beyond what TextExpander's built-in macros can do, so I resort to AppleScript. Just set the content type of your snippet to AppleScript, and paste in the following code: Snippet: Abbreviation: NEXTSUN 10. Current Week Range: I also sometimes need to insert a range of dates representing the current week. Again, this goes beyond the capabilities of TextExpander's build-in macros, so I use AppleScript. Again, set the content type to AppleScript, and paste in the following: Snippet: Abbreviation: CWEEK

    By Ben Waldie Read More
  • AppleScripting OmniFocus: send due tasks to iTunes

    OmniFocus is a great tool for keeping us organized. But, let's face it. We're busy people. That's why we need a task management app in the first place. How can you take your productivity to the next level? How about having your daily OmniFocus tasks read to you as you drive to work? With a little help from AppleScript and Automator you can make that happen. Here's how... Setup In order to run this script and workflow, you'll need to make sure you have an OmniFocus perspective named Due, and that it's set up to display any tasks that are considered Due Soon. This is a default perspective, so you probably already have it. You can adjust what's considered Due Soon in the Data section of OmniFocus' Preferences window, under Dates & Times. Building the Workflow Note: If you get stuck or have trouble following along, you can download the complete AppleScript and Automator workflow here. 1. Launch Automator and create a new iCal Alarm workflow. Creating an iCal Alarm workflow in Automator 2. Find and add the Run AppleScript action to the workflow, and enter the following AppleScript into the action's script area. When run, this script opens OmniFocus, displays the Due perspective, retrieves a list of tasks, and generates an audio file on the Desktop. The Run AppleScript action handles the OmniFocus work 3. Add the Import Audio Files action to the workflow, and set it to Delete source files after encoding. This action imports the audio file and cleans up afterward 4. Insert the Add Songs to Playlist action. Set it to add to a New playlist named OmniFocus. This action adds the imported audio file to the OmniFocus playlist. It only creates it if it doesn't already exist. 5. Save the workflow as OmniFocus > Send Due Tasks to iTunes. When you do this, iCal opens and a new event is added to an Automator calendar, which is created if it doesn't already exist. The event is configured with an Open File alarm set to run the workflow. Saving the workflow puts it in the proper location and automatically creates an iCal event 6. Set the workflow to run each day at the desired time. You can set the workflow to run anytime you want Once configured, the workflow should run as scheduled. When it does, it should retrieve list of your OmniFocus due tasks, convert them to audio, and import them into an OmniFocus playlist. Example Due tasks in OmniFocus The imported audio task list can be added to your iPhone for on-the-go access

    By Ben Waldie Read More
  • AppleScripting OmniFocus > Swap Task Names and Notes

    I use OmniFocus on a daily basis to keep track of important tasks. On a few occasions, I've entered tasks and assigned notes to them, only to decide later that I'd rather use the note as the task name, and the task name as the note. Rather than manually cycling through my tasks and swapping the notes, I wrote an AppleScript to do it. Now, anytime I want to perform this task, I can simply run the script. Here's how I did it... Creating the Script 1. Launch AppleScript Editor (in /Applications/Utilities). 2. If your system-wide script menu isn't enabled already, go into AppleScript Editor's preferences window and turn it on. The script menu is enabled in AppleScript Editor's preferences window. 3. Create a new script document and enter the following code: Note: You can download the complete script here. 4. Bring OmniFocus to the front, and from the system-wide script menu, choose Open Scripts Folder > Open OmniFocus Scripts Folder. This creates the following folder, if it doesn't already exist - ~/Library/Scripts/Applications/OmniFocus. The script menu automatically creates application script folders if they don't exist 5. Go back to AppleScript Editor and save the script as OmniFocus > Swap Selected Task Names and Notes into the ~/Library/Scripts/Applications/OmniFocus folder you opened in the last step. Scripts added to the OmniFocus scripts folder appear in the script menu only when OmniFocus is in the front Running the Script To run the script, just select one or more tasks in OmniFocus. Then, select OmniFocus > Swap Selected Task Names and Notes from the script menu. The script retrieves the selected tasks, loops through them, and swaps their names and notes. You can run the script a second time, if you decide you'd rather swap them back. Some OmniFocus tasks with notes Trigger the script from the script menu to process selected notes The script warns you that swapping task names and notes will remove any note formatting The script notifies you when processing is complete. It skips any notes that contain attachments, and lets you know if this occurred. The processed OmniFocus tasks, with swapped names and notes Whether you need to swap task names and notes or not, this should give you some insight into the scripting capabilities of OmniFocus. I'll be posting other OmniFocus scripts in the future. So, if you're an OmniFocus user, stay tuned. If you're not an OmniFocus user, then you should be. Go to the Omni Group's website and download the trial today! Happy scripting!

    By Ben Waldie Read More
  • Preparing high-res icon files with Automator

    This week's post is for all those Mac app developers out there. If you're not an app developer yet, it's a new year, and I'm sure becoming an app developer is at at the top of your resolution list. In any case, if you plan to develop apps, then you need to prepare icons for those apps. Apple provides very specific requirements for generating high resolution icons, which you can find listed on the Apple Developer Connection website. In the past, Xcode came with a tool named IconComposer, which could be used to generate icon files. This tool, however, didn't generate high res icon files, so Apple now discourages its use. Instead, Apple provides instructions for generating icons using an iconset, a folder of image files that can be converted to an icon file using either Xcode or the iconutil command line tool. There are, of course, other ways of creating icons. In this post, however, we'll focus on an iconset. To manually generate an iconset folder, you start by creating a square image to serve as your icon. Next, you generate versions of the image scaled to 16x16, 32x32, 128x128, 256x256, 512x512. These scaled versions are to be named as follows: icon_16x16.png icon_16x16@2x.png icon_32x32.png icon_32x32@2x.png icon_128x128.png icon_128x128@2x.png icon_256x256.png icon_256x256@2x.png icon_512x512.png icon_512x512@2x.png You place all of these images into a folder named FolderName.iconset. Then, you can process it with iconutil to generate an icns file. Sure, creating scaled images and processing them isn't too difficult, but it's a lot of repetitive work. If you create icons regularly, it can get tedious. You're probably thinking, surely, Automator can be used to streamline the process. It can. Here, we'll create an application workflow you can run anytime you want to convert an image to an icon file. Let's get started... Note: If you're an iOS developer, feel free to adjust the workflow below accordingly. Creating the Workflow Launch Automator and create a new Application workflow. Next, insert and configure the following actions. Note: This workflow is pretty long and repetitive. It's easy to get lost. If you get stuck, don't worry, you can download the complete workflow here, along with a sample icon image. 1. Ask for Finder Items - Set this action to ask for an image file at least 1024x1024 in size. 2. New Folder - Set this action to create a folder named MyIcon.iconset on your Desktop. 3. Set Value of Variable - From the popup menu in this action, choose New Variable and create a variable named iconset folder. 4. Get Folder Contents 5. Change Type of Images - Set this action to convert images to PNG format. 6. Scale Images - Set this action to scale the image to a size of 1024 pixels. 7. Rename Finder Items - Set this action to name a single item's basename only to icon_512x512@2x. This represents a 1024 image (i.e. a Retina display ready size) when the icon is created. Note that this action's title changes in the workflow to reflect the type of naming, in this case Name Single Item. 8. Duplicate Finder Items 9. Scale Images - Set this action to scale the image to a size of 512 pixels. 10. Rename Finder Items - Set this action to name a single item's basename only to icon_512x512. 11. Duplicate Finder Items 12. Rename Finder Items - Set this action to name a single item's basename only to icon_256x256@2x. 13. Duplicate Finder Items 14. Scale Images - Set this action to scale the image to a size of 256 pixels. 15. Rename Finder Items - Set this action to name a single item's basename only to icon_256x256. 16. Duplicate Finder Items 17. Rename Finder Items - Set this action to name a single item's basename only to icon_128x128@2x. 18. Duplicate Finder Items 19. Scale Images - Set this action to scale the image to a size of 128 pixels. 20. Rename Finder Items - Set this action to name a single item's basename only to icon_128x128. 21. Duplicate Finder Items 22. Scale Images - Set this action to scale the image to a size of 64 pixels. 23. Rename Finder Items - Set this action to name a single item's basename only to icon_32x32@2x. 24. Duplicate Finder Items 25. Scale Images - Set this action to scale the image to a size of 32 pixels. 26. Rename Finder Items - Set this action to name a single item's basename only to icon_32x32. 27. Duplicate Finder Items 28. Rename Finder Items - Set this action to name a single item's basename only to icon_16x16@2x. 29. Duplicate Finder Items 30. Scale Images - Set this action to scale the image to a size of 16 pixels. 31. Rename Finder Items - Set this action to name a single item's basename only to icon_16x16. 32. Get Value of Variable - Set this action to get the iconset folder variable you created way back at the beginning of the workflow. You also need to set this action to ignore its input, so it doesn't continue processing the 16x16px image from the previous action. Select Action > Ignore Image. 33. Run Shell Script - Set this action to pass input as arguments. Then, enter the following command: iconutil -c icns "$@" Preparing the Run the Workflow Before you begin running the workflow, you need an image you can convert to an icon. Note that iconutil requires this image to be square. So, make sure it is. If you really want to be sure it's square, you can insert a Crop Images action between steps 5 and 6, and configure it to crop to 1024x1024, scaling to the shortest side before copping. However, if your image contains transparency, this action will remove it. So, it's best to prepare your starting image as a square. Running the Workflow When you run the workflow, you're first asked to choose an image. Select the desired image and click Choose. The workflow runs, an iconset folder is created on your Desktop and passed to iconutil, which generates an icns file. You're ready to plug your icns file into your app. Now, any time you need to generate an icon, just create a square image and trigger your workflow. Happy New Year and Happy App Developing!

    By Ben Waldie Read More
  • AppleScript Desktop Icon Race

    Scripty Claus' gift to you this Holiday Season is a fun little AppleScript that lines up your Desktop icons and races them across the screen until one of them reaches the finish line. Here's how to set it up... Note: You can download the complete script here. 1. Launch AppleScript Editor in /Applications/Utilities. 2. Enter the code shown. 3. Run the script to start the fun. When the script runs, it calculates how many icons are allowed in the race and lines the lucky contestants up along the left side of your screen. Any remaining icons are deemed spectators, and are lined up along the right side of your screen. The race begins and the contestants randomly race to the virtual finish line on the right side of the screen. The first one to reach the finish line is the winner. At the end of the race, your icons are moved back to their original locations. Pre-race Desktop Starting the race A winner is announced! Happy Holidays and Happy Scripting!

    By Ben Waldie Read More
  • Where Automator Actions and Workflows Live

    Automator's great for streamlining some of the repetitive things you do each day on your Mac. With Automator, you can create your own custom plugins for the Services menu, Folder Action workflows that run when files are placed into a folder, add-ons for the print window's PDF menu, and more. In most cases, when you save a workflow, Automator puts it where it needs to go automatically. But, where do your workflows actually live? If you want to remove or edit one, you'll need to know. In this post, we'll take a look at the various places workflows are found on your Mac. Actions Before exploring the different resting places for workflows, let's discuss actions. Actions are the building blocks of your workflows. To use them, they need to be installed somewhere Automator can find them. There are four places actions can reside on your Mac: Apps - Often, an app that supports Automator contains embedded actions. When Automator launches, it scans the apps on your Mac, loads their actions (if they have any), and displays them in the action library. Aperture is an app that contains embedded Automator actions /System/Library/Automator - This is where Apple puts all of the standard actions that come with OS X, such as actions for Calendar, Mail, and Safari. /Library/Automator - Here, you may find some non-embedded third-party actions. The Microsoft Office actions, for example, are installed here. Actions in this folder are available to all user accounts on your Mac. ~/Library/Automator - If you double-click action files you've downloaded or choose File > Import Actions... in Automator, the actions are installed here automatically. These actions are available to you, but not to other users on your Mac. Actions are installed into one of the three /Library/Automator folders Note: To access the Library folder in your home directory, press Option and choose Go > Library from the Finder's menu bar. Workflows Automator's template chooser panel gives you lots of choices when creating workflows Automator allows you to construct workflows in a variety of formats, each of which has its own benefits and use cases. When you build a workflow, you choose the most appropriate format for your needs. Then, when you save the workflow, Automator either asks you to choose an output folder, or it saves it automatically into a specific location based on the workflow's format. Applications Automator workflow applications are just like other apps. You double-click them and they run. When you save a workflow as an application, Automator allows you to choose its location. You can put it anywhere, such as your Applications folder, Documents folder, etc. Once saved, you can even drag it to your Dock for quick access. Workflows A workflow file is a saved Automator document. Double-click it to open it in Automator for editing. Like applications, workflow files can be saved anywhere you wish. Calendar Alarms A Calendar alarm workflow is a specifically configured application, that is intended to be run from a Calendar event's alarm at a scheduled date and time. These types of workflows are saved into the ~/Library/Workflows/Applications/Calendar folder in your home directory. A Calendar Alarm workflow is configured to run from an Open File alarm Automator installs Calendar alarm workflows into your ~/Library/Workflows/Applications/Calendar folder Services Service workflows appear in the Services menu and contextual menus throughout OS X. They're typically used to perform some automated function on selected text, files, images, and more. These types of workflows are saved into the ~/Library/Services folder in your home directory. You can move a saved Service into the /Library/Services folder to make it accessible to all users on your Mac. Service workflows appear in the Services menu and contextual menus throughout OS X Service workflows are saved into the ~/Library/Services folder Service workflows can also be enabled/disabled or be assigned to hot keys in System Preferences, under Keyboard > Keyboard Shortcuts > Services. System Preferences provides a place to manage your service workflows Print Plugins Print plugins appear in the PDF menu of the print dialog throughout OS X. They're used to process printed PDFs. For example, you might create a print plugin that renames a printed PDF and uploads it to your FTP server. These workflows are installed into the ~/Library/PDF Services folder in your home directory. Like Services, you can move print plugins into the /Library/PDF Services folder in order for all users of your Mac to access it. Print plugin workflows show up in the print window's PDF menu throughout OS X Print plugin workflows are saved in the ~/Library/PDF Services folder Folder Action Workflows Folder actions are workflows that are attached to folders and configured to run when new files are placed into the folder. Folder actions are saved into the ~/Library/Workflows/Folder Actions/ folder in your home directory. Folder actions can be configured using the Folder Action Setup app, which you can access by Control+Clicking on a folder and choosing Services > Folder Action Setup. You can access Folder Actions Setup via the Finder's contextual menu Folder Action Setup allows you to enable, disable, and edit Folder Action scripts and workflows Image Capture Plugins Image Capture plugins are workflows that appear in the Image Capture app. They can be configured to run to process images as you're downloading them from a camera. For example, you might make an Image Capture plugin that adds copyright metadata to your images, backs them up to an offsite server, and then imports them into iPhoto automatically as they are downloaded. Image Capture plugins are saved into the ~/Library/Workflows/Image Capture folder in your home directory. Image Capture plugins can be set to process your downloaded camera images Script Menu Workflows Finally, although Automator doesn't presently include an option for saving workflows in the OS X script menu, you can place them there yourself. Just save your workflow as a Workflow file or application and move it into the ~/Library/Scripts or /Library/Scripts folder. The script menu offers a nice location for organizing and gaining quick access to scripts and workflows. You can turn on the script menu in the preferences window of AppleScript Editor in /Applications/Utilities. The script menu in OS X also allows you to run Automator workflows You enable the system-wide script menu in AppleScript Editor's preferences window So, now you should have a pretty good handle on where your various Automator workflows reside. If you're still getting started with Automator, this information will no doubt come in handy soon, as you follow along with some of my future posts.

    By Ben Waldie Read More
  • Send Keynote presenter notes to Evernote with AppleScript

    We've all been there before. You've prepared a Keynote presentation on the Internet phenomenon of cat videos for your local Mac user group. You've finished editing your slides. You've added presenter notes. Next, you want to extract the notes from your slides and bring them into Evernote so you can look them over and maybe use them as the basis for your forthcoming newsletter article. You open your presentation in Keynote and select File > Export. Then, it happens. You remember that Keynote doesn't have a feature for exporting presenter notes. Sure, you could copy them one by one into Evernote, but that will take a while. Fortunately, you know this can be done quickly and easily with AppleScript. Here's how you'll do it... Creating the Script First, you need to write a script. NOTE: If you have any trouble following along, you can download the complete script here. 1. Launch AppleScript Editor (in /Applications/Utilities). 2. Create a new script document, and enter the following code: 3. Save the AppleScript Editor document in Script format to your Desktop as Send Keynote Presenter Notes to Evernote.scpt. AppleScript Editor documents can be saved as Scripts or Applications. Save your document as a Script. Enabling the Script Menu Next, you need a quick and easy way to trigger the script. You can use the handy system-wide script menu. If it's not enabled on your Mac already, here's how you can turn it on. 1. Choose AppleScript Editor > Preferences... 2. Ensure that the Show Script menu in the menu bar checkbox is selected. Once enabled, you should see a script icon appear in your menu bar. The script menu is turned on in AppleScript Editor's preferences window. Installing the Script Next, you're ready to add your newly created script into the script menu. This way, you can quickly trigger it whenever you're in Keynote with an opened presentation. 1. Go into Keynote. 2. From the script icon in your menu bar, select Open Scripts Folder > Open Keynote Scripts Folder. The script menu provides quick and easy navigation to your scripts folder. 3. Copy the Send Keynote Presenter Notes to Evernote.scpt file from your Desktop into the ~/Library/Scripts/Applications/Keynote folder that opens. The Keynote Scripts folder is created automatically if it doesn't already exist. Running the Script Now that your script is installed, it's ready to run whenever you need it. 1. Open a Keynote presentation containing presenter notes. The presenter notes area is located beneath your slides. If this area isn't visible, choose View > Show Presenter Notes. 2. From the script menu, choose Send Keynote Presenter Notes to Evernote. Application scripts are contextual and automatically appear in the script menu when the target app is frontmost. 3. When prompted, specify whether you would like to extract slide content, in addition to the presenter notes. The AppleScript can extract presenter notes and/or slide content. The choice is yours. The script extracts the slide titles, presenter notes, and, if necessary, the slide content from your opened Keynote presentation. Next, the script reformats the extracted content as HTML, brings Evernote to the front, and creates a new note. An Evernote note containing extracted Keynote notes. Your notes are now ready for review in Evernote on your Mac. Assuming you've got Evernote's iOS app too, your notes are also synced to your iPhone and/or iPad. As you ride the train to work and excitedly begin working on your newsletter article, feel free to share your knowledge of cat videos with the person next to you. Happy scripting!

    By Ben Waldie Read More
  • Preparing Blog Images with Automator

    Automator's the perfect tool for streamlining some of the repetitive things you do on a daily basis. One thing it's great at is doing basic manipulation to lots of image files. Need to resize a bunch of images or convert them from one format to another? No problem, Automator is ready to help. In this post, you'll build an Automator workflow that prepares images for your blog by renaming them sequentially and then scaling them down in size. Don't have a blog? Well, this workflow could also be used for preparing images for insertion into a Word document, or to send in an email. Feel free to adjust to your specific needs. Building the Workflow Note: If you have any trouble following along, you can download the complete workflow here. 1. Launch Automator (in your Launchpad or /Applications folder) 2. When the workflow template panel appears, select Service and click Choose. By creating a service, you'll be able to run the workflow on selected files in the Finder. Creating an Automator Service workflow 3. At the top of the workflow (on the right side of Automator's window), set the Service to receive image files in the Finder. By setting this, the Finder uses its contextual knowledge to only let you run the workflow when you have image files selected. Setting the workflow to process images in the Finder 4. Search for the New Folder action and add it to the workflow. Enter Scaled for Web into the Name field and leave it set to create the folder on the Desktop. Note that this action has some hidden functionality. First, it knows not to create the folder if one already exists. Second, it receives the selected image files as input when the workflow runs, and it copies them into the newly created folder. This ensures that any manipulations are done later to duplicates, and your original images remain unharmed. The New Folder action copies your selected images in the Finder into a Scaled for Web folder on the Desktop 5. Find and add the Get Folder Contents action to the workflow. This action retrieves any files in the Scaled for Web folder. The Get Folder Contents action gets the duplicated image files for processing 6. When Automator processes files, it doesn't always do so in the order you expect. This can be a problem if you want to rename files sequentially. To solve the problem, you'll tell the workflow to sort them. Locate the Sort Finder Items action and drag it to the workflow area. Configure the action to sort the files by name in ascending order. The Sort Finder Items action makes sure your images are renamed in the proper order 7. Search for the Rename Finder Items action and drag it to the workflow. Automator warns you that this action changes the names of files, and suggests inserting a Copy Finder Items action too, in order to preserve the original names. The first step in your workflow already copies the original images. So, there's no need to copy them a second time. Click Don't Add to tell Automator not to insert the additional Copy Finder Items action. Automator often warns you when files are modified and suggests working with copies From the popup menu in the upper left corner of the action, choose Make Sequential (note that the name of the action in your workflow changes to Make Sequential). Set the action to add a number to a new name and enter a dash, followed by the desired name. Configure the other settings to place the number after the name, to separate by a dash, to start numbers at 1, and to make all numbers 2 digits long. Configure the Rename Finder Items action to sequentially name your images 8. Next, you'll tell Automator to add the date to the beginning of each image's name. Since the Rename Finder Items action doesn't include this option, you'll use a variable. Click Variables at the top of the action library and locate the Today's date variable. Automator variables let you insert values that are calculated at runtime into your workflows Drag the Today's date variable to the beginning of the new name field in the Rename Finder Items action. By default, this variable is set to the format M/D/YYYY. The Finder, however, doesn't like slash characters in file names. So, you'll configure the variable to use dashes instead, and to be formatted in YYYY-MM-DD format for better sorting. Click the triangle button on the right side of the variable and choose Edit... The date variable is editable Choose Custom format... from the format menu in the Variable Options window that appears. Custom formatting allows you to specify a precise format for a date variable Drag year, month, and day components together into the editing field and separate them with dashes. Click the triangle to the right of the month and day components, and set them to appear as two digits. Click Done when you're finished. Formatting the Today's date variable as YYYY-MM-DD 9. Find the Scale Images action and drag it to the end of the workflow. Again, Automator warns you about modifying your images. And, again, since your workflow is already working with duplicates, you should be safe. Click Don't Add so the Copy Finder Items action isn't inserted too. Automator really, really, really wants to protect your files. If you get annoyed by these alerts, click the checkbox to prevent future ones from appearing. Configure the Scale Images action to resize your images To Size (pixels) and enter the desired pixel size. Note that this is on the longest side of the image. The Scale Images action resizes your blog images 10. Save the workflow as Blog - Scale Images. Automator installs it where it needs to go. Saving the workflow as a Service makes it accessible in the Finder Running the Workflow In the Finder, select a bunch of images and right click to display the contextual menu. Choose Services > Blog - Scale Images to run the workflow. Your workflow appears in the Finder's contextual menu when you have image files selected The workflow runs, creates a Scaled for Web folder on your Desktop, copies the images into the folder, renames them sequentially, and scales them the appropriate amount. The renamed and scaled images are copied into a Scaled for Web folder on your Desktop Now, with the help of your new Automator service, you can get back to writing, and spend less time editing images. Happy blogging!

    By Ben Waldie Read More
  • Cascade Finder windows with AppleScript

    You're busy. You've got tons of things going on at any given time. Your Mac's screen is constantly cluttered with a bazillion Finder windows, and you keep shuffling them around to find the one you need. Sure, Mission Control in Mountain Lion lets you view all of your Finder windows at once in a pretty tiled view. But, it doesn't sort them, and with a ton of little windows, finding the one you want is no piece of cake. How nice would it be if the Finder had a "Cascade Windows" feature? With a little help from AppleScript, your wait is over. In this post, you'll write a simple AppleScript that sorts your opened Finder windows and cascades them, making it quick and easy to find the one you want and clearing your cluttered screen in the process. Let's get started. Does your screen look like this, with windows everywhere? AppleScript can help. Expose shows your Finder windows, but it's still not always easy to find the one you need If you get stuck with any of the scripting in this post, you can download the complete scripts here. Prep Work First, you'll need some opened Finder windows. If you're interested in the topic of this post, then odds are good that you already have plenty of opened windows. If not, you can open some, or you can run the following AppleScript to create some for testing. Just open up AppleScript Editor in your /Applications/Utilities folder, paste in the following script and run it. The script creates a folder named Cascade Windows Test on your Desktop, adds 10 subfolders to it, opens them, and randomly positions them on your screen. The Cascade Windows Test script creates a bunch of folders and opens them, ready for cascading. Writing the Script Create a new AppleScript Editor document and paste in the following script. Comments have been provided to explain each portion. Running the Script When you're ready, go ahead and run the script. Or, for quick access, save the script as an application and drag it to your Dock. When run, the script asks you to specify how many pixels you'd like between the menu bar and the first window. A default value of 10 pixels is suggested. Tell the script how far down you'd like the first window positioned Next, the script asks you how many pixels you'd like between the left side of the screen and the first window. Again, a default of 10 pixels is suggested. Tell the script how far over you'd like the first window positioned The script asks you how many pixels high you'd like each window, suggesting 300. Give the script a desired window height The script asks how many pixels wide to make each window, suggesting 350. Give the script a desired window width Choose how far apart you'd like the windows from one another. The default is 25 pixels, and should allow enough space to see each window's title bar. Specify an offset between the cascaded windows Finally, the script asks if you want to cascade the windows to the right. Doing so creates a staggered effect. Choose whether you want your cascaded windows staggered to the right The script finds any opened Finder windows, sorts them alphabetically by folder name, and cascades them. Cascaded Finder windows, staggered to the right Cascaded Finder windows without staggering With your windows cascaded by name, just scan through the title bars to find the one you need and click it to bring it to the front. Your days of searching through a cluttered screen of windows has come to an end.

    By Ben Waldie Read More
  • Create Evernote 5 template notebooks with AppleScript

    Evernote 5 is a wonderful app for gathering information and keeping it organized and synchronized between your devices. In Evernote, you create notebooks and fill them with notes. These notes can be anything - thoughts, web clippings, files, photos, audio, etc. Whenever you need to recall information you've added to Evernote, just type in a few keywords to instantly locate it. This post shows how to use AppleScript to create template notebooks that contain default template notes. You can use these templates for creating new projects, jobs, or anything else you might need. Let's get started. To Configure 1. First, go to the Documents folder in your home directory and create a folder named Evernote Templates. 2. Go into Evernote and begin creating some notes to serve as templates for your notebook. Suppose you're creating a template for a design project. You might create template notes for materials, meeting notes, phone notes, a status report, etc. Go ahead and enter placeholder text and assign default tags for these notes, as well. Creating template notes in Evernote 3. Once you've created your template notes, select them all. You're going to export them so they can be imported later when you want to create a notebook. Selecting your template notes in Evernote 4. Choose File > Export Notes to bring up the export window. When prompted, enter a name for your template notebook, such as Design Project, and save it into the Evernote Templates folder in your Documents folder. Make sure you're saving in Evernote XML Format (.enex), and that you've chosen to Include tags for each note. Exporting your template notes as an Evernote XML file 5. Repeat the process for any other template notebooks you might want. A folder of exported Evernote XML files that serve as templates 6. Launch AppleScript Editor, located in /Applications/Utilities, and create a new document. 7. Enter the following script into the document: (If you have any trouble, you can download the complete script here.) 8. Save the script as an application and drag it to your Dock, so you can quickly trigger it at any time. Saving the AppleScript as an application To Use Launch the AppleScript application you saved (if you prefer to test right from AppleScript Editor instead, click Run in the toolbar). First, the script looks in your Evernote Templates folder and retrieves a list of exported .enex files. It then asks you to choose one. Choosing a notebook template Next, the script asks you to enter a name for the new notebook. Type the desired name, and click OK. Entering a notebook name The script creates a new Evernote notebook named accordingly, and imports the chosen .enex file. The script then searches the opened Evernote window for the newly imported notes. A new notebook created from a template Notes imported into the newly created notebook Congratulations, you've written your very own notebook template utility for Evernote! Now, with only a few clicks, you can quickly create notebooks containing pre-existing default notes.

    By Ben Waldie Read More
  • Build a photo calendar with Automator

    You've seen it in your Launchpad. You've seen it in your Applications folder. It's Automator. It sounds cool. It looks cool. It's got a cool robot icon. But, what can it really do, and why should you care about it? Well, Automator can do lots of things to improve and streamline your OS X experience. With Automator, you use building blocks called actions like ingredients in a recipe. When your actions are strung together, the result is an Automator workflow that can perform a series of tasks. Apple provides lots of built-in actions for automating things with Calendar, Mail, Safari, and more. You get even more actions as you install Automator-ready apps, like Aperture, BBEdit, Microsoft Office, and Transmit. What you can do with Automator depends on the actions installed on your Mac. So, you may run into limitations if you don't have actions for certain tasks, or if an app doesn't support Automator. For simple things like working with folders, images, and PDFs, however, it's a great tool that can save you time and let you do some fun stuff. In this post, I'll show you how to use Automator to create a print plugin that shows up in the PDF menu when you print a document. This specific plugin lets you print a photo calendar right out of the Calendar app.

    By Ben Waldie Read More