2011年3月13日日曜日

Cocoa ObjC 備忘録 NSPerformService

NSPerformService
デベロッパドキュメントから引用。すぐ忘れるからな。

NSPerformService
Programmatically invokes a Services menu service.

BOOL NSPerformService (
NSString *itemName,
NSPasteboard *pboard
);
Parameters
itemName
Specifies a Services menu item, in any language. If the requested service is from a submenu of the Services menu, the value must contain a slash (for example, “Mail/Selection”).
pboard
The pasteboard containing the data required by the service. This data must be present for the service to succeed. On output, this pasteboard contains the data returned by the service provider.
Return Value
YES if the service was successfully performed or NO if it was not.

Discussion
Use this function to programmatically invoke a service found in the application’s Services menu.

Availability
Available in Mac OS X v10.0 and later.
Related Sample Code
PhotoSearch
Declared In
NSApplication.h

NSPasteboard* pb=[NSPasteboard generalPasteboard];
へ?このあとどうやって書くんだろ。明日以降。
Spinにめどがついたので次の小物ツールを計画中。こんどは「辞書引き専用PDFビューワ」はできるかな、と考えている。幸いADCにPDFビューワの原型がサンプルであがっているので、それに手を入れる方向でいけばなんとかなるかな、と。

NSPerformServiceを使えば、選択した文字列を辞書.appに渡せるようだ。
しかしPDFkitは手に余るかもなあ。

0 件のコメント:

コメントを投稿