Creating Your Own Service
Services
advertisements, such as the one
we listed earlier for the Stickies application, are stored in the
application’s
Info.plist
file, an XML-encoded file stored inside
the .app wrapper. When Mac OS X registers a new
application, it opens up the Info.plist file and
looks for the application’s application icon, its
document icons, and its Services advertisement (if it exists). This
information is cached to improve performance.
Table 20-4 lists all of the fields allowed in the Services advertisement.
Table 20-4. Services advertisement fields
|
Field |
Meaning |
|---|---|
|
Message |
Name of the message to be sent. |
|
NSExecutable |
Name of the application’s executable. |
|
NSKeyEquivalent |
Key equivalent, if any, that the Services menu item should have. |
|
NSMenuItem |
Name that should appear in the Services menu. If you want to have a submenu, use the forward slash (/). For example, to have “equation” be a submenu of “graph”, you would use the string “graph/equation”. |
|
NSMessage |
Actual message that is sent to your application to cause the service to be executed. Messages are implemented with the Cocoa distributed object system. |
|
NSPortName |
Name of the Mach port where the message should be sent. Normally, this will be the name of your application’s “Identifier,” defined in the Application Settings tab in PB. |
|
NSReturnTypes |
Pasteboard types that the method can return. |
|
NSSendTypes |
Pasteboard types that the method can send. |
|
NSTimeout |
Numerical string that is the time, ... |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access