Re: [MacRuby-devel] Mixing Objective-C and Ruby classes

2009-05-21 Thread Brian Chapados
You're welcome. I've looked into adding global hot keys before, but never too seriously, so I definitely learned a few things as well. As for the problem with aixmlserialize, I wouldn't assume that it is a 32/64-bit issue. In this case, it was obvious what was going on from the documentation. Ge

Re: [MacRuby-devel] Mixing Objective-C and Ruby classes

2009-05-20 Thread isaac kearse
Brian you are a legend,That works perfectly, no errors or warnings. I think I might have run into a similar issue when I tried to compile this framework: http://github.com/Caged/aixmlserialize/tree/master (NSXMLDocument => NSDictionary conversion) I ended up just extracting the one method that I w

Re: [MacRuby-devel] Mixing Objective-C and Ruby classes

2009-05-20 Thread Brian Chapados
I was able to reproduce your bug, and have a fix. This was somewhat obscure, but RTFM to the rescue... Note that GetApplicationEventTarget is not available on 64-bit systems (see Notes in the docs): http://developer.apple.com/documentation/Carbon/Reference/Carbon_Event_Manager_Ref/Reference/refere

Re: [MacRuby-devel] Mixing Objective-C and Ruby classes

2009-05-20 Thread Brian Chapados
I didn't use the hotcocoa cli interface to generate the file, so I don't have a Rakefile or anything. I just used a text editor and followed an old example[1]. Try putting the ruby code into a file called 'shortcutapp.rb' and type: [1]: http://andymatuschak.org/articles/2008/09/12/hotcocoa-is-pre

Re: [MacRuby-devel] Mixing Objective-C and Ruby classes

2009-05-20 Thread isaac kearse
Hi Brian, I tried running your minimal app but it crashed with a similar error. Here are all the gory details (including Problem Details and System Profile from the crash reporter): http://gist.github.com/114723 I have also put the whole directory structure for the minimal hotcocoa app on github

Re: [MacRuby-devel] Mixing Objective-C and Ruby classes

2009-05-19 Thread isaac kearse
Yeah I think you're right. I was calling it inside a hotcocoa app but not in the application context. I'll try it out tonight and let you know how it goes. Thanks a lot for walking me through this. On Wed, May 20, 2009 at 12:47 PM, Brian Chapados wrote: > I'm not sure how you're testing this,

Re: [MacRuby-devel] Mixing Objective-C and Ruby classes

2009-05-19 Thread Brian Chapados
I'm not sure how you're testing this, but beware of doing this from a command line-only script or through macirb. I suspect you need to be in an Application context (or hook into the event loop through some other means). It works from a minimal hotcocoa app: http://gist.github.com/114523 I also

Re: [MacRuby-devel] Mixing Objective-C and Ruby classes

2009-05-19 Thread isaac kearse
Hey thanks Brian that worked! I tried compiling with the Carbon Framework but I didn't think to try it with both Carbon and Foundation. I still got the warning "makes pointer from integer without a cast" but I'm just ignoring that :) So the bundle was created and I compiled it and required it my

Re: [MacRuby-devel] Mixing Objective-C and Ruby classes

2009-05-19 Thread Brian Chapados
Those symbols are defined in the Carbon framework. Try compiling with: cc shortcut.m -o shortcut.bundle -g -framework Foundation -framework Carbon -dynamiclib -fobjc-gc -arch i386 -arch x86_64 On Tue, May 19, 2009 at 1:32 PM, isaac kearse wrote: > Hi Guys, > I am writing a hotcocoa app, and I wa

Re: [MacRuby-devel] Mixing Objective-C and Ruby classes

2009-05-19 Thread isaac kearse
Hi Guys, I am writing a hotcocoa app, and I want to register a global keyboard shortcut so that I can perform an action in my app from any application. AFAIK you need to go down to Carbon to do this as documented here: http://cocoasamurai.blogspot.com/2009/03/global-keyboard-shortcuts-with-carbon.

Re: [MacRuby-devel] Mixing Objective-C and Ruby classes

2009-04-20 Thread victor jalencas
Many thanks John and Laurent. After reading your messages I came back to XCode and discovered I had made a typo in the ObjC part of the code (which, curiously, compiled) and that's why my ruby code didn't find my selector. As for calling ruby code from the obj-c side, I agree it's a bit convolu

Re: [MacRuby-devel] Mixing Objective-C and Ruby classes

2009-04-17 Thread Laurent Sansonetti
Hi Victor, On Apr 16, 2009, at 4:23 AM, macruby-de...@principia.info wrote: Hi, I'm new both to this list and to MacRuby. Let this message serve as an introduction. I have some questions that have not seen answered either in the docs or in the list archives. I have been known to miss t

Re: [MacRuby-devel] Mixing Objective-C and Ruby classes

2009-04-17 Thread John Shea
Hello Victor, I see that there is not much action on the list at the moment - so I will reply - the heavyweights do eventually drop by - but they are very busy so it is a bit sporadic (unless its just my gmail playing up again). I haven't actually tried 2 and 3 on your list since I am try

[MacRuby-devel] Mixing Objective-C and Ruby classes

2009-04-16 Thread macruby-devel
Hi,  I'm new both to this list and to MacRuby. Let this message serve as an introduction.  I have some questions that have not seen answered either in the docs or in the list archives. I have been known to miss things before, so please kindly point  me in the right direction if this is documented