Graphics & design software

Automator workflow of the month: Easy voice memos on your Mac

Much as we all enjoy typing the kind of text snippets that make up our daily reminders and thoughts, it can be easier and more effective to record a voice memo. Sure, you can do that with an iPhone or most iPods, but what about with your Mac? In this month’s look at Apple's automation utility, Automator, I demonstrate how to do just that. Additionally, I offer steps for taking a simple workflow and, with the addition of a couple of actions, making it more user-friendly and useful. The initial workflow goes like this. (You can download the completed, most complicated version of the workflow here.)

Set up your workflow

Launch Automator and in the New Template sheet that appears, select Service and click Choose. Build a workflow that contains these actions: New Audio Capture, Start Capture, and Stop Capture (all under Movies). In the Start Capture action enable the Wait For Capture To Complete option. In the Stop Capture action enable the Close Movie After Stopping option. Configure the top of the window to read Service Receives No Input in Any Application. Save your workflow and give it an intuitive name such as Voice Memo.

Voice memo window
When you activate your workflow, the small Audio Recording window will appear.

If you now click Automator’s Run button, QuickTime Player will launch, a new audio recording window will appear, and your Mac will start recording from the sound input device selected in the Sound system preference (from your iMac or MacBook’s microphone, for example). When you’re finished recording, just press the spacebar and your recording will be saved, the audio recording window will close, and you’ll find your voice memo saved as Audio Recording.mov in the Movies folder within your user folder. (Subsequent recording will be called Audio Recording followed by a number—Audio Recording 1.mov, for example.)

Give it a keyboard shortcut

Launch System Preferences, select the Keyboard system preference, and click the Keyboard Shortcuts tab. Select Services in the left pane and in the right pane look for the General heading. Your Voice Memo service should appear at the bottom of this list of services. Click to the right side of it and a text field will appear. Press a keyboard shortcut that you’d like to use for this service—I used Command-Option-9. You should now be able to press Command-Option-9 in any application and record a voice memo.

Get a little fancier

Let’s make this workflow a little more interesting by telling the user exactly what to do as well as give them the opportunity to name the resulting file. This workflow will contain these actions: New Audio Capture, Start Capture (under Movies); Ask for Confirmation (under Utilities); Stop Capture (under Movies), and Run AppleScript (under Utilities).

This time, in the Start Capture action do not enable the Wait for Capture to Complete option. In the Ask for Confirmation workflow enter Audio Recording in the Message field and in the text field below enter something like, “Now recording. Click ‘Stop Recording’ when you’re finished.” Double-click in the OK Button field (it will highlight) and replace the text there with 'Stop Recording.'

In the Stop Capture action enable the Close Movie After Stopping option. In the Run AppleScript action enter (or copy and paste in) this text:

on run {input, parameters}
	
	activate
	repeat
		display dialog "Enter the name for the audio recording:" default answer ""
		set the recording_name to the text returned of the result
		if the recording_name is not "" then
			if the recording_name ends with ".mov" then
				set the recording_name to text 1 thru -4 of the recording_name
			end if
			exit repeat
		end if
	end repeat
	
	set this_recording to the first item of the input
	tell application "Finder"
		set the parent_folder to the container of this_recording
		set the counter to 1
		set the new_name to the recording_name & ".mov"
		repeat
			if exists document file new_name of the parent_folder then
				set the new_name to the recording_name & "-" & counter & ".mov"
				set the counter to counter + 1
			else
				set the name of this_recording to the new_name
				delay 1
				return (document file new_name of the parent_folder) as alias
			end if
		end repeat
	end tell
end run

Now you're ready to save the workflow and give it a keyboard shortcut, as you did above.

What does our newer, fancier workflow do? When you initiate the workflow, a dialog box appears that reads, “Now recording. Click ‘Stop Recording’ when you’re finished.” In this dialog box you’ll see Cancel and Stop Recording buttons. When you click Stop Recording the audio capture stops. You’re then prompted for a name for the recording. Once you enter it and click OK, the recording is saved to the Movies folder in your user folder.

Make it e-mail automatically

Now let’s add one more action to automatically e-mail our voice recording to someone. To do that all you need to do is add a New Mail Message action (under Mail) to the end of the workflow. If you like, you can configure an account to send the message from using the Account pop-up menu at the bottom of the action. You can also enter a subject and message. For example, the subject might read “I have something to say to you” and a following message reading, “Listen up, buster!”

The finished workflow
When the more complicated version of this workflow is completed, it should look like this.

Now when you initiate the workflow, everything that took place with the previous workflow happens again, but additionally, once you’ve completed and named your recording, Apple’s Mail launches and a new message appears with your voice memo attached. Any subject heading and message you added to the workflow is automatically added to the message and the message is configured to be sent from the account you chose in the workflow. All you need to do is address the message and send it.

Subscribe to the Apple @ Work Newsletter

Comments