Re: [MacRuby-devel] Custom URL scheme (again)

2011-01-11 Thread Martin Hawkins
Caio wins again! Thanks - I was sure I had tried that already. Need to be a bit more organised I think... Thanks again. On Jan 11, 4:49 pm, Caio Chassot wrote: > On 2011-01-11, at 14:30 , Martin Hawkins wrote: > > >   sharedAEManager.setEventHandler(self, > > andSelector: :"getURL:event:withReply

Re: [MacRuby-devel] Custom URL scheme (again)

2011-01-11 Thread Caio Chassot
On 2011-01-11, at 14:30 , Martin Hawkins wrote: > sharedAEManager.setEventHandler(self, > andSelector: :"getURL:event:withReplyEvent:returnEvent", > forEventClass: KInternetEventClass, andEventID:KAEGetURL) > … > > def getURL(event, withReplyEvent:returnEvent) So the selector for that method d

Re: [MacRuby-devel] Custom URL scheme (again)

2011-01-11 Thread Joel Reymont
On Jan 11, 2011, at 4:30 PM, Martin Hawkins wrote: > def getURL(event, withReplyEvent:returnEvent) ... > Typing 'experimental://' in the Safari address bar produces an error: > experimental[4759]: -[AppDelegate > getURL:event:withReplyEvent:returnEvent]: unrecognised selector sent > to instance

[MacRuby-devel] Custom URL scheme (again)

2011-01-11 Thread Martin Hawkins
I went back to this today to take it a step further and found my way blocked - it seems to be a MacRuby thing because this is trivial to implement in Objective-C. This code is now: framework 'Cocoa' class AppDelegate def initialize registerExperimental @eventDescriptor = NSAppleEventDes

Re: [MacRuby-devel] Custom url scheme

2011-01-10 Thread Martin Hawkins
That seems to have fixed it! Many thanks to you all for your help. On Jan 10, 7:59 pm, Caio Chassot wrote: > Try installing the latest bridge support. > > http://bridgesupport.macosforge.org/trac/wiki/Releases > > On 2011-01-10, at 17:18 , Martin Hawkins wrote: > > > > > > > > > Now that's inter

Re: [MacRuby-devel] Custom url scheme

2011-01-10 Thread Caio Chassot
Try installing the latest bridge support. http://bridgesupport.macosforge.org/trac/wiki/Releases On 2011-01-10, at 17:18 , Martin Hawkins wrote: > > Now that's interesting - I tried your macirb experiment and get a > different result: > mar...@polaris:~ macirb > irb(main):001:0> framework 'Found

Re: [MacRuby-devel] Custom url scheme

2011-01-10 Thread Martin Hawkins
The constant *should* be there - this is an excerpt from my HIServices/ InternetConfig.h / Apple event constants *

Re: [MacRuby-devel] Custom url scheme

2011-01-10 Thread Martin Hawkins
Now that's interesting - I tried your macirb experiment and get a different result: mar...@polaris:~ macirb irb(main):001:0> framework 'Foundation' => true irb(main):002:0> KInternetEventClass NameError: uninitialized constant KInternetEventClass irb(main):003:0> framework 'Cocoa' => true irb(main

Re: [MacRuby-devel] Custom url scheme

2011-01-10 Thread Caio Chassot
On 2011-01-10, at 16:47 , Martin Hawkins wrote: > > Excellent Caio - thanks. > Now I've gone full circle and am getting > 'AppDelegate::KInternetEventClass (NameError) > from /Users/martin/work/macruby/experimental/build/Debug/ > experimental.app/Contents/' Maybe that constant is not there

Re: [MacRuby-devel] Custom url scheme

2011-01-10 Thread Martin Hawkins
Excellent Caio - thanks. Now I've gone full circle and am getting 'AppDelegate::KInternetEventClass (NameError) from /Users/martin/work/macruby/experimental/build/Debug/ experimental.app/Contents/' Code is now: framework 'Foundation' # framework 'ApplicationServices' - it doesn't matter wh

Re: [MacRuby-devel] Custom url scheme

2011-01-10 Thread Martin Hawkins
Joel, I've also got to change getURL to def getURL(event, returnEvent) # do something with event here to parse the url end so I go with your suggestion, I'm going to get 'wrong number of arguments (0 for 2)' On Jan 10, 5:59 pm, Joel Reymont wrote: > On Jan 10, 2011, at 5:52 PM, Martin Ha

Re: [MacRuby-devel] Custom url scheme

2011-01-10 Thread Caio Chassot
On 2011-01-10, at 15:52 , Martin Hawkins wrote: > > Thanks Matt, I've got the book but missed that point. > Any suggestions re my second issue. i.e. translating the selector part You can pass a selector as a symbol or string: m.setEventHandler(self, andSelector: :"getURL:event:withReplyEvent:re

Re: [MacRuby-devel] Custom url scheme

2011-01-10 Thread Joel Reymont
On Jan 10, 2011, at 5:52 PM, Martin Hawkins wrote: > sharedAEManager.setEventHandler(self, andSelector:getURL(event, > withReplyEvent:returnEvent), forEventClass:kInternetEventClass, > andEventID:kAEGetURL) This does not produce any errors: sharedAEManager.setEventHandler(self, andSelector:g

Re: [MacRuby-devel] Custom url scheme

2011-01-10 Thread Martin Hawkins
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 equiva

Re: [MacRuby-devel] Custom url scheme

2011-01-10 Thread Matt Aimonetti
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 wrote: > I'm trying to create

[MacRuby-devel] Custom url scheme

2011-01-10 Thread Martin Hawkins
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 # Ap