Mac OS X Services - Changes between Tiger, Leopard and Snow Leopard

When a file or folder is selected in the Finder and a Mac OS X Service is invoked, either through the Services menu or its keyboard shortcut, the input fed to the service depends on what version of Mac OS X is running.
  • In Tiger, (10.4), no input is fed to the service.
  • In Leopard (10.5), the absolute path to the file is the input. E.g. "/Users/steve/tablet.rtf"
  • In Snow Leopard (10.6), if the service is configured properly to work on files and folders, then the input will be file URL like "file://Users/steve/tablet.rtf".
In Leopard, any service that accepted selected text would automatically work with selected files or folders in the Finder. However, Snow Leopard changed that. It is still possible for a service to accept both selected text and files plus folders, but if you create a Service using Automator, you are forced to choose one or the other. So, pick one and save your Service. For this example, I'm assuming you picked 'Files and Folders'.

Next, edit the ~/Library/Services/Foo.workflow/Contents/Info.plist and change this:


to this:


Then, in the Python program that is your service, you may want something like this to detect that your input is a file path:

if input.starswith('file://') or input.startswith('/'):
# I think I got a file path as input

For more details, see Services Properties in the Mac Dev Center. Happy holidays!


Darrell Golliher said...

Curious about what service you wrote. Anything you can tell us about?


Pythonic Avocado said...

Hi Darrell,

It started with a service to open specific requests in HelpSpot if a request ID number was selected. From there the service has grown over time to cover other uses. For example, searching HelpSpot based on a name or email address, looking up USPS tracking numbers etc). One keyboard shortcut and a few simple heuristics based on the input are so useful that I can't imagine life w/o them now.

Anonymous said...


Schnabel Alta said...

I am coming back to this article and also re-reading it creativity in the course of tacky period. I have faith that keep your own biceps and triceps through to the downhills and also shout the guts away. Flower Lace Lingerie