URL Scheme Handled by a Rev Application
Andre Garzia
andre at andregarzia.com
Thu Jan 24 18:16:48 EST 2008
Andres,
create a frontscript and trap the appleEvent event. Look for a event
like GURL (it's GURLGURL). I used to have a example of that somewhere
nearby.
You need the frontscript because Revolution IDE will trap the events
before you if you don't use one. It's something like:
on appleEvent theClass,theID -- execute a set of statements in a text file
if theClass is "GURL" and theID is "GURL" then
request appleEvent data -- get the content of the AppleEvent into
the it variable
-- now do your stuff
end if
pass appleEvent
end appleEvent
Andre
On 1/24/08, Andres Martinez <andres at bakno.com> wrote:
> Thanks Andre
>
> I finally made it work by rebuilding the Launch Services database.
>
> Now the part I don't know yet is how to receive the parameters in my
> Rev App.
>
> For example if the URL is myapp:parameters
>
> How can I read those parameters when the system invokes the Rev App?
>
> Regards,
> Andres Martinez
> www.baKno.com
>
> On Jan 24, 2008, at 6:01 PM, Andre Garzia wrote:
>
> > Andres,
> >
> > I am searching for doing the same thing. By altering the plist, you
> > also need to touch the file to advertise to Finder that it needs to
> > refresh its database. There are other ways too. The best way would be
> > to create an external binding into the launch services API.
> >
> > In the past, I did a hack that could do this kind of stuff by altering
> > some plists and default entries on mac os x tiger.
> >
> > check this post http://article.gmane.org/gmane.comp.ide.revolution.user/73700
> >
> > I had a stack to create such custom protocol entries for mac os x, but
> > I can't find it... maybe it was destroyed with my old machine when it
> > fried. :-) If I find it and you still want it, I can send to you.
> >
> > andre
> >
> > On 1/24/08, Andres Martinez <andres at bakno.com> wrote:
> >> 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
> >>
> >> _______________________________________________
> >> 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
> >>
> >
> >
> > --
> > http://www.andregarzia.com All We Do Is Code.
> > _______________________________________________
> > 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
>
> _______________________________________________
> 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
>
--
http://www.andregarzia.com All We Do Is Code.
More information about the use-livecode
mailing list