URL Scheme Handled by a Rev Application

Andres Martinez andres at bakno.com
Thu Jan 24 16:39:35 EST 2008


Hello again,

With more google search I found the following...

------------------------------------------
Here is what you need to do to register your app for a custom URL  
scheme (for the example we will use a "myapp" scheme).
1) In your Info.plist, add a new entry for CFBundleURLTypes?:

<key>CFBundleURLTypes</key>
	<array>
		<dict>
			<key>CFBundleURLName</key>
			<string>MyApp's URL</string>
			<key>CFBundleURLSchemes</key>
			<array>
				<string>myapp</string>
			</array>
		</dict>
	</array>
2) Somewhere in your application's startup code (e.g. init), add this  
code:

- (void)registerMyApp
{
	[[NSAppleEventManager sharedAppleEventManager] setEventHandler:self  
andSelector:@selector(getUrl:withReplyEvent:)  
forEventClass:kInternetEventClass andEventID:kAEGetURL];
}

- (void)getUrl:(NSAppleEventDescriptor *)event withReplyEvent: 
(NSAppleEventDescriptor *)replyEvent
{
	NSString *url = [[event paramDescriptorForKeyword:keyDirectObject]  
stringValue];
	// now you can create an NSURL and grab the necessary parts
}
------------------------------------------

Now, I need to know how can I run such code from within my Rev app.


Regards,
Andres Martinez
www.baKno.com

On Jan 24, 2008, at 4:15 PM, Andres Martinez wrote:

> Hello
>
> I found the following text in this page...
> http://www.euronet.nl/~tekelenb/playground/security/URLschemes/
>
> --------------------------------------------------
> "The Finder automatically registers all applications as it becomes  
> aware of them, such as [...] when the user navigates to a folder  
> containing them."
>
> Part of that registration involves LaunchServices (an under-the-hood  
> thing, somewhat similar/related to InternetConfig) to check if a  
> thusly found application advertises itself as being capable of  
> handling a specific URL scheme. If the executable can do http for  
> example, it will contain that information in such a way that Finder  
> can access it (and pass the info on to LaunchServices).
> --------------------------------------------------
> Does anybody know how to include this type of information into OSX  
> Rev applications?
>
>
> Regards,
> Andres Martinez
> www.baKno.com
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list