[MacRuby] #391: HotCocoa on_notification method stopped functioning in MacRuby 0.5 under Snow Leopard
#391: HotCocoa on_notification method stopped functioning in MacRuby 0.5 under Snow Leopard --------------------------------------+------------------------------------- Reporter: trevor@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: HotCocoa on_notification --------------------------------------+------------------------------------- I have a small MacRuby/HotCocoa application that uses the on_notification method described by Richard Kilmer in his post of Sept 19 2008 http://lists.macosforge.org/pipermail/macruby- devel/2008-September/000539.html This application worked well under MacRuby 0.4 and Mac OS 10.5. It intercepts Spotify Growl messages to obtain track title and artist information to pass into an AppleScript Studio via a small window that it creates. The MacRuby/HotCocoa app was provided by a friendly software developer, Peter MacRobert, for me since ASS did not have the appropriate inter-process message handling capability. The script for the app is attached. I upgraded to Snow Leopard and discovered that the app crashed out with MacRuby 0.4. I succeeded in downloading and installing MacRuby 0.5 and now the app loads successfully with no error messages as before under Leopard. Unfortunately the on_notification code does not get triggered any longer. No error messages, just stubbornly refuses to respond when the Distributed Notifications Center gets the Spotify message. I am able to see that the message is there by firing up Growl which shows the message each time Spotify plays a track. Under Mac OS 10.5, it was necessary to have Growl stopped for this app to be able to intercept the message coming out of Spotify destined for the Growl alert. I'm afraid I am not familiar with what is required to set up a test case. All I can do is describe the situation. I believe that Spotify is now available in the USA, it's a music streaming application (excellent btw, if you're not familiar). When running a Spotify session every time a track is launched it sends a message to the Distributed Notifications Center containing the Track Artist & Title information, if the system has Growl installed and configured for Spotify, a Growl alert will appear to the configured spec in Growl. If my MacRuby script is running (and, under 10.5, Growl is turned off) it will intercept the Spotify message and show the Artist and track name in the two text fields of the window that it opens. This may sound crazy to you and it would take a while to explain why I have this application. Briefly, it's used by an Applescript Studio App that I wrote (hobby only, not commercial) which controls Spotify and hides the windows to play a "Beat the Intro" game for competing teams. The MacRuby window is hidden and is used to pass the track details from Spotify to the ASS application. I'm sure that there would be a much easier way to test the HotCocoa on_notification method than setting up a test with my script and using Spotify. But I'm afraid I do not know how to do that. Regards Trevor Hills -- Ticket URL: <http://www.macruby.org/trac/ticket/391> MacRuby <http://macruby.org/>
#391: HotCocoa on_notification method stopped functioning in MacRuby 0.5 under Snow Leopard --------------------------------------+------------------------------------- Reporter: trevor@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: HotCocoa on_notification --------------------------------------+------------------------------------- Comment(by lsansonetti@…): Could you try to reduce the problem to a script that doesn't require a 3rd party app to be installed? -- Ticket URL: <http://www.macruby.org/trac/ticket/391#comment:1> MacRuby <http://macruby.org/>
#391: HotCocoa on_notification method stopped functioning in MacRuby 0.5 under Snow Leopard --------------------------------------+------------------------------------- Reporter: trevor@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: HotCocoa on_notification --------------------------------------+------------------------------------- Comment(by trevor@…): I'm struggling with this, I'm afraid. I've got simple scripts suggested by the original post on the on_notification method from Richard Kilmer to work under Snow Leopard. I now cannot go back to Leopard to see whether my Spotify track grabber code still works there, all I know is that it used to under Leopard and it doesn't now under SL. It must be something else that has changed in the Spotify use of the notification that is causing it not to trigger the on-notification in the MacRuby/HotCocoa script. Maybe the named=> 'GrowlNotification' has changed or something has tightened up in the syntax. I'm looking for a way to check that out but a bit short of knowledge on how to get a trace of the message and all I can see is what comes out of Growl if it is turned on, which is the normal track notification alert. Anyway, I'm willing to believe that it isn't a bug in MacRuby/HotCocoa. So, thanks for the attention. And happy for the ticket to be closed. Even happier if anybody has some suggestions for me! regards Trevor Hills -- Ticket URL: <http://www.macruby.org/trac/ticket/391#comment:2> MacRuby <http://macruby.org/>
#391: HotCocoa on_notification method stopped functioning in MacRuby 0.5 under Snow Leopard --------------------------------------+------------------------------------- Reporter: trevor@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: HotCocoa on_notification --------------------------------------+------------------------------------- Comment(by hoffmann@…): # OS X 10.6.1 # MacRuby 0.5 beta 1 # MacRuby macruby_nightly-2009-10-28-1306.pkg # Simple script: require 'hotcocoa' include HotCocoa application do on_notification :named => 'NSWindowDidResizeNotification' do | notification| puts "A window resized!" end end # ERROR LOG: # 2009-10-29 13:54:05.667 macruby[11291:903] __CFServiceControllerBeginPBSLoadForLocalizations timed out while talking to pbs regards, Robert -- Ticket URL: <http://www.macruby.org/trac/ticket/391#comment:3> MacRuby <http://macruby.org/>
#391: HotCocoa on_notification method stopped functioning in MacRuby 0.5 under Snow Leopard --------------------------------------+------------------------------------- Reporter: trevor@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: HotCocoa on_notification --------------------------------------+------------------------------------- Comment(by mattaimonetti@…): bug confirmed, I also added another example. -- Ticket URL: <http://www.macruby.org/trac/ticket/391#comment:4> MacRuby <http://macruby.org/>
#391: HotCocoa on_notification method stopped functioning in MacRuby 0.5 under Snow Leopard --------------------------------------+------------------------------------- Reporter: trevor@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: HotCocoa on_notification --------------------------------------+------------------------------------- Comment(by mattaimonetti@…): bug fixed by Rich. {{{ $ ./miniruby -I./lib ~/tmp/hotcocoabug.rb Received notification of NSWindowDidUpdateNotification on my window Received notification of NSWindowDidUpdateNotification on my window Received notification of NSWindowDidUpdateNotification on my window Received notification of NSWindowDidUpdateNotification on my window Received notification of NSWindowDidBecomeMainNotification on my window Received notification of NSWindowDidBecomeKeyNotification on my window Received notification of NSWindowDidUpdateNotification on my window Received notification of NSWindowDidUpdateNotification on my window }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/391#comment:5> MacRuby <http://macruby.org/>
#391: HotCocoa on_notification method stopped functioning in MacRuby 0.5 under Snow Leopard --------------------------------------+------------------------------------- Reporter: trevor@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: blocker | Milestone: Component: MacRuby | Resolution: fixed Keywords: HotCocoa on_notification | --------------------------------------+------------------------------------- Changes (by mattaimonetti@…): * status: new => closed * resolution: => fixed -- Ticket URL: <http://www.macruby.org/trac/ticket/391#comment:6> MacRuby <http://macruby.org/>
#391: HotCocoa on_notification method stopped functioning in MacRuby 0.5 under Snow Leopard --------------------------------------+------------------------------------- Reporter: trevor@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: blocker | Milestone: Component: MacRuby | Resolution: fixed Keywords: HotCocoa on_notification | --------------------------------------+------------------------------------- Comment(by rich@…): Replying to [comment:6 mattaimonetti@…]: Here is what i am observing is happening. i just committed code to hold all listeners but when you do: on_notification ... end there is an object created internally which is the listener. that object is being garbage collected. it was likely a bug under 0.4 that did not garbage collect this but now it is. you can do one of two things. reinstall macruby after my commit tonight OR just do: @listener = on_notification ... end thus you hold that in an instance variable so it will not be garbage collected. See if that works -- Ticket URL: <http://www.macruby.org/trac/ticket/391#comment:7> MacRuby <http://macruby.org/>
#391: HotCocoa on_notification method stopped functioning in MacRuby 0.5 under Snow Leopard --------------------------------------+------------------------------------- Reporter: trevor@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: blocker | Milestone: Component: MacRuby | Resolution: fixed Keywords: HotCocoa on_notification | --------------------------------------+------------------------------------- Comment(by trevor@…): Workaround with instance variable works just fine. Thank you. And thanks to Robert for his help. Rgds Trevor Hills -- Ticket URL: <http://www.macruby.org/trac/ticket/391#comment:8> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby