Invoking a filter service
Invoking a filter service
- Subject: Invoking a filter service
- From: "Timothy J. Wood" <email@hidden>
- Date: Thu, 29 Apr 2004 21:19:45 -0700
A few AppKit classes have magical filter-invoking powers, but I'm
trying to both provide and utilize a filter service, but having no
luck. The archives don't seem to have any useful info on invoking
services; only providing them.
My application has the following in its plist:
<key>NSServices</key>
<array>
<dict>
<key>NSFilter</key>
<string>_filterOutline</string>
<key>NSPortName</key>
<string>OmniOutliner</string>
<key>NSReturnTypes</key>
<array>
<string>NXTypedFileContentsPboardType:xmloutline</string>
<string>NXTypedFileContentsPboardType:ooutline</string>
<string>NSTypedFilenamesPboardType:xmloutline</string>
<string>NSTypedFilenamesPboardType:ooutline</string>
<string>NSTypedFilenamesPboardType:rtf</string>
<string>NXTypedFileContentsPboardType:rtf</string>
</array>
<key>NSSendTypes</key>
<array>
<string>NXTypedFileContentsPboardType:xmloutline</string>
<string>NXTypedFileContentsPboardType:ooutline</string>
<string>NSTypedFilenamesPboardType:xmloutline</string>
<string>NSTypedFilenamesPboardType:ooutline</string>
</array>
</dict>
</array>
I can then do something like the following in a tool:
NSPasteboard *filterPasteboard = [NSPasteboard
pasteboardByFilteringFile:inputFile];
NSLog(@"types = %@", [filterPasteboard types]);
and see the appropriate types listed. But, I'm having no luck
actually *invoking* the service (in fact *nothing* in the service
providing app happens as far as I can see -- objc_msgSend doesn't even
get called when I invoke my calling tool).
I've tried -dataForType:, -readFileContentsType:toFile: and various
less likely combinations. I've tried passing
NSCreateFileContentsPboardType([outputFile pathExtension]) and
NSCreateFilenamePboardType([outputFile pathExtension]) as the type.
I've tried all sorts of stuff! :)
I've tried using -[NSAttributedString
initWithPath:documentAttributes:] (since it is one of the classes with
filter super-powers) in the hope that since I declare 'rtf' as a return
type, my service would get invoked. No dice.
Is there an example I'm missing?
-tim
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.