--- In [email protected], "quantiworks" <quanticwo...@...> wrote: > > Sheri, thanks for taking the time to do it but does it work for you when a > song isn't playing? > > I found out that if a track is playing, there isn't any error and the label > is shown but when it reaches the end and stops, the same error I posted > earlier pops-up and crashes PowerPro. > Also, the com.unload isn't unloading because I still need to kill PowerPro > manually. > > Yesterday, after following your suggestions, I got the same results as your > script with the exception that when PowerPro crashed it ended it's process. > > Here's what I was trying: > > ------------------------------------ > static iTunesApp = com.create_object("iTunes.Application") > static Tstr = iTunesApp.CurrentTrack.Artist ++ " - " ++ > iTunesApp.CurrentTrack.Name > > ; win.debug(iTunesApp.CurrentTrack.Artist ++ "-" ++ > iTunesApp.CurrentTrack.Name) > > com.release(iTunesApp) > com.unload > quit(Tstr) >
Called from the label of a bar button, the script is going to run every one or two seconds. That is not enough time to create the object and return the info and release the object and unload the plugin every time before it gets run again. So that (mostly) explains why your version above doesn't work. Do you have any documentation of the interface? There is probably a way to query whether or not there is a track loaded before asking for the Artist and Name of that track. I haven't used it very much but my version seems to work for me as long a song is playing or paused, or I have Quit the player. When the com plugin gives an error (such as when the player is loaded but no track is active), I can cancel that execution and it resolves. But I am running it from the tooltip instead of the label, so I have some control over when the script gets run. Regards, Sheri
