How to Create a Simple Service to Append Text to a file


How to Create a Simple Service to Append Text to a file
Quick Mac Tip, 30 January 2011

Quickly adding URLs and text clippings to a file after I’ve narrowed down my research helps me solve problems on a website I do volunteer maintenance for. I clip bits of code to rewrite and use to solve an issue or keep ideas for future development. Today I discovered that I could simply create a Service in Automator to do that for me.

This guest Tip is written by April Mains, Arteliance.

Creating a service using Automator is quick and easy. For this example I will be appending text to a BBEdit text file but it also works with TextEdit.

April Mains.

April Mains has been doing print design since 1985 and working with Mac computers since 1989. She has been hanging out with Miraz on everything from mailing lists to twitter since 1996. April began blogging in 2005 and can be found at Arteliance as well as on twitter and facebook.

Create A Simple Service in Automator:

  1. Open Automator and choose the Service template
  2. Drag Set Contents of BBEdit Document to the workflow area
  3. Choose By: Appending from the drop-down menu (the other two options are: Replacing Entire Contents and Replacing Selection)
  4. Save your Service with a descriptive name
Open Automator and choose the Service template.

Open Automator and choose the Service template.

Now I can simply select text and use the OS X Contextual Menu > Services > [New_Service_Name] to append the selected text to a BBEdit text file. I use this mainly to add urls or snippets to the inbox of my todo list.

An Append to BBEdit Scratchpad service already exists and might be useful as well.

Note that for this menu item to function, BBEdit must be running and a text document must exist.

Choose By: Appending from the drop-down menu.

Choose By: Appending from the drop-down menu.

Bonus Tip:

You can also create an Automator app to Ask for Text and then Set Contents of BBEdit Document > By: Appending to enter your own text and add it to your todo list or text file.

Save as Application to ~/Library/Scripts and then use FastScripts (free for up to 10 keyboard shortcuts) to set a shortcut for your new program.

What’s your experience with Automator and Services? Tell us in the Comments. Could you write a guest MacTip? If so, contact me.

Related posts

[wpzon keywords="pressure cooker" sindex="PCHardware" snode="1232597011" sort="salesrank" listing="8"]


Top