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 > here http://www.cocoadev.com/index.pl?HowToRegisterURLHandler and 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-devel@lists.macosforge.org > http://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