My other stuff:

Services - useful actions for Mac OS X 10.6 (Snow Leopard)

by Matt Sephton

Background

“The Services menu in Mac OS X lets you use features of one application while working in another. In Snow Leopard, services are more simplified, streamlined, and helpful. The Services menu is contextual, so it shows just the services appropriate for the application you’re using or content you’re viewing rather than all available services. You can access services with a right click of your mouse or Control-click of your trackpad. You can configure the menu to show only the services you want, and you can even create your own services using Automator.” —Apple

Calculate!

These use the bc command to calculate the mathematical result of expressions within the selected text in any application.

Calculate & Append (1.01, 39kb zip) 29 August 2009
— Selected text is appended with result.
Calculate & Replace (1.01, 36kb zip) 29 August 2009
— Selected text is replaced.
Calculate & Speak (1.05, 62kb zip) 29 August 2009
— Selected text is not modified, but is spoken out loud along with the result. Just for kicks.
Calculate Services (137kb zip) 29 August 2009
— All of the above.

Example expressions: 2+2 1/2 1024/16 (1/3 + 10 - 10) * 3 2 ^ 64 scale=5;pi=4*a(1);pi x=3;y=4;z=sqrt(x^2+y^2);z

Calculate Services

Other Services

Delete Resource Fork (1.00, 38kb zip) 02 October 2009
— Deletes resource fork of selected files. Make sure you know what you're deleting is not important file data!

Installation

Put the Service at ~/Library/Services/ (current user only) or /Library/Services/ (for all users).
Optionally, assign a shortcut key through System Preferences.

How to configure a Service

  1. Step 1. In the Application menu choose Services/Services Preferences...
  2. Step 2. System Preferences/Keyboard/Keyboard Shortcuts/Services
  3. Step 3. Select a service, press Enter and then press your chosen shortcut key combo

How to invoke/use a Service

  1. Use a shortcut key combo
  2. Use the contextual (right-click) menu
  3. Use the Services menu in the Application menu

How to create a Service in Automator

  1. Step 1. Tick the 'Replaces Selected Text' box
  2. Step 2. Drag the 'Run Shell Script' action into your service
  3. Step 3. Enter the shell command
  4. Step 4. Save as the name you'll see in the context menu

Editing

Double click a Service to edit it using Automator.

Version history

02 October: Added Delete Resource Fork (1.00)
29 August: Updated Calculate & Append (1.01), Calculate & Replace (1.01), Calculate & Speak (1.04) to remove trailing zeros. Calculate & Speak now speaks more English (1.05)
28 August: Introduced Calculate & Append (1.00), Calculate & Replace (1.00), Calculate & Speak (1.03)
2009

Links

Mac OS X Automation by Apple’s Sal Soghoian
How to create a Service to sort paragraphs of text
man bc the calculator used by the services
http://osx.iusethis.com/app/calculateservices