Re: Still need help with Services. Is there sample code?
Re: Still need help with Services. Is there sample code?
- Subject: Re: Still need help with Services. Is there sample code?
- From: Daryle Walker <email@hidden>
- Date: Fri, 19 Sep 2014 03:49:56 -0400
On Sep 18, 2014, at 7:13 PM, Keary Suska <email@hidden> wrote:
> On Sep 18, 2014, at 3:22 PM, Daryle Walker <email@hidden> wrote:
>
>> I removed the old style type (“NSStringPboardType”) and it still worked. When I changed the “public.plain-text” to “public.url” and tested with the entry field on Firefox, Safari’s “Open URL” service showed up, but my version didn’t! Same thing happened using “NSURLPboardType” as the send type. Renaming the public name of my service, so it wouldn’t match Safari’s, didn’t work. Changing the send-type to “public.url-name” didn’t work.
>>
>> Now we narrowed what’s wrong. I still don’t know how to fix it.
>
> At this point, you are probably just looking at a UTI issue. Standard UTI's are documneted in the UTCoreTypes.h header. I don't know if they are documented elsewhere. Simply open terminal and execute "locate UTCoreTypes.h" to find the various headers.
Well, I got the “public.url” and “public.url-name” UTIs from Apple Development’s UTI guides. But before reading this post, I’ve been thinking about other line of attack.
I said that my “Open URL” doesn’t register, but Safari’s does. So I want to see Safari’s NSServices information to see what it does. To my shock, it’s not there! I have no idea where the “Open URL” service that triggers Safari is located; I couldn’t find anything useful via Spotlight or the “find” Unix command. I was about to give up when I remembered that the Services menu shows Safari’s “Add to Reading List” command, and I did see that in Safari’s Info.plist.
When I read the NSServices entry for “Add to Reading List,” I found out that Safari cheats! The service only takes RTF and UTF-8 text, put there’s a required-context block that filters in only URL strings and http(s) strings. (The latter filter is enabled by an Apple-private(?) key called “NSLinkSchemes.”)
…
I did a web-search on “NSLinkSchemes,” and found a text dump of all of someone’s services, and the “Open URL” service was listed as being from a “/System/Library/CoreServices/SystemUIServer.app.” Sure enough, my copy of that app has the service, and lists “NSURLPboardType” and “NSStringPboardType” as its send-types (in that order). Maybe I should follow the lead of one of these services.
(The “/Applications/Font Book.app” was the only other app in the dump that took “NSURLPboardType,” and it was for both of its two services, and the fourth out of five types for both services.)
…
Now my web-searching has found a private Pasteboard type “WebURLsWithTitlesPboardType” that could be what Safari used to create URL & Title entries.
—
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden