[MacRuby-devel] Custom url scheme
Martin Hawkins
martin.hawkins at gmail.com
Mon Jan 10 09:05:08 PST 2011
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
More information about the MacRuby-devel
mailing list