Thanks Matt, I've got the book but missed that point. Any suggestions re my second issue. i.e. translating the selector part of sharedAEManager.setEventHandler(self, andSelector:getURL(event, withReplyEvent:returnEvent), forEventClass:kInternetEventClass, andEventID:kAEGetURL) into it's Ruby equivalent?
thanks for the above. On Jan 10, 5:29 pm, Matt Aimonetti <mattaimone...@gmail.com> wrote: > In Ruby constants start by an upper case letter, swap `kInternetEventClass' > by `KInternetEventClass' and give it a try. > For a bit more > info:http://ofps.oreilly.com/titles/9781449380373/ch01.html#_constant_names > > - Matt > > On Mon, Jan 10, 2011 at 9:05 AM, Martin Hawkins > <martin.hawk...@gmail.com>wrote: > > > > > I'm trying to create a custom URL scheme following the instructions > > herehttp://www.cocoadev.com/index.pl?HowToRegisterURLHandlerand in > > the Cocoa Scripting Guide p108. I've not been getting anywhere! I've > > got at least two problems here: > > (I'm running OS X 10.6.6 with MacRuby 0.8) > > > # Attempt #1 > > # AppDelegate.rb > > # experimental > > framework 'Foundation' > > framework 'ApplicationServices' > > > class AppDelegate > > def initialize > > registerExperimental > > end > > > def registerExperimental > > sharedAEManager = NSAppleEventManager.sharedAppleEventManager > > sharedAEManager.setEventHandler(self, andSelector:getURL, > > forEventClass:kInternetEventClass, andEventID:kAEGetURL) > > end > > > def getURL > > end > > end > > > The above results produce an error - > > undefined local variable or method `kInternetEventClass' > > despite the fact that they are defined in HIServices/ > > InternetConfig.h. Is this where I need to delve into the depths of > > BridgeSupport? > > > If the above is changed to > > def getURL(event, returnEvent) > > # do something with event here to parse the url > > end > > then I get wrong number of arguments (0 for 2) (ArgumentError) which > > is what I expected, but I am confused as to how to parse the > > 'andSelector' part of the code and > > sharedAEManager.setEventHandler(self, andSelector:getURL(event, > > withReplyEvent:returnEvent), forEventClass:kInternetEventClass, > > andEventID:kAEGetURL) > > is clearly wrong. > > > Any guidance as to how to fix these two issues will be most gratefully > > received! > > thanks > > _______________________________________________ > > MacRuby-devel mailing list > > macruby-de...@lists.macosforge.org > >http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel > > _______________________________________________ > MacRuby-devel mailing list > macruby-de...@lists.macosforge.orghttp://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel