Bellhop Help

Configuring Services

Before the services that you create are made available in the Services menu, you must take steps to configure them using the inspector. The inspector allows you to manipulate various parameters which control the appearance and availability of the services in the Services menu. The figure below shows the settings inspector .


Settings inspector

Service ID – The service ID is an internal identifier for each service, and is automatically assigned when a new service is created. It is not editable.

Context – The context shows the language plug-in in which the service's code is written. It is the context in which the actual service will be executed. This value is not editable.

Label – Every service has a label, which is how the service is displayed in the Services menu. The label will become the menu item title for the service, which will be displayed in a submenu whose title comes from the collection name.

Key Equiv. – You can assign key equivalents for a service. In the Services menu, the modifier keys will always be Cmd+Shift plus the key that you enter in this text field. Note that key equivalents for services should be used sparingly, since there is no guarantee that they'll be available. If an application defines the same key equivalent, then it takes precendence over the service. If two services define the same key equivalent, there is no guarantee as to which one is used.

Timeout (Textfield) – The timeout text field specifies the amount of time to wait (in seconds) before a service times out. Mac OS X will automatically timeout a service if it has not completed within the timeout period. If you have services that wait on user input, you should set this to a high enough value so that your service doesn't timeout waiting for user input. The default timeout value is 30 seconds.

Active – The active checkbox determines whether or not the selected service is to be advertised in the Services menu. You can use this checkbox to disable any services that you might be developing so that they don't show up prematurely.

Accepted Pasteboard types – This list of types describes what types of pasteboard data the service will accept. All services must declare what types they accept, and similarly, all applications declare what types of data they can provide. For example, the TextEdit application can provide string data to services, as well as RTF content. Note that this declaring accepted pasteboard types is optional. For example, you might have a service that simply returns data or shows an alert message (e.g. a service to insert some predefined text into some text). By checking these types in the list, you will ensure that your service will show up in the Services menu for the TextEdit application. Note that if a service declares pasteboard types that are not provided by an application, then that service will not show up in the application's Services menu. For example, say you've created a service that accepts string data. If you were in a graphics application that could only provide image data, then that graphics application's Services menu will not display the service. In fact, it will only display those services that can accept image data. For a list of available pasteboard types, see the About Services section of this help guide.

Returned Pasteboard types – Similar to the notion of accepted pasteboard types, the returned pasteboard types list describes the types of pasteboard data that a service gives back to a requesting application. For a list of available pasteboard types, see the About Services section of this help guide. The declaration of returned pasteboard types is also optional. For example, you might have a service that only operates on data, but doesn't return anything to the requesting application. For example, the Get Stock Quote for Ticker Symbol service simply takes a ticker symbol and displays an alert panel, but doesn't return anything to the requesting application.

 

Adding Comments

The inspector also has a "Comments" tab, which you can use to add descriptive text to your services. These comments are saved in the database, and are also included when you export services as "Service Packs" (see the section on Sharing Services). Figure 9 shows the contents of the comments inspector.


Comments inspector