New scripting features in MM 2.5.2

Download and get help for different MediaMonkey for Windows 4 Addons.

Moderators: Peke, Gurus

psyXonova
Posts: 785
Joined: Fri May 20, 2005 3:57 am
Location: Nicosia, Cyprus
Contact:

Post by psyXonova »

KK, plz this has become really annoying...

Jiri, after several unsuccesfull attempts to register "OnPlay", "OnShutdown" and all the other events I copied the code you provided inside a test.vbs autoscript.

None of the registered events works except the timer.
In other words i get a msgbox every 10 sec but i cant get any other msgbox no matter how many times i start palyback, pause it, stop it, exit MM or update track properties...
WHAT IS THE PROBLEM???????
jiri
Posts: 5433
Joined: Tue Aug 14, 2001 7:00 pm
Location: Czech Republic
Contact:

Post by jiri »

I have just retested and all events work as they should. Which code exactly did you use, with which version and where did you put it?

Jiri
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

I've got an OnTrackProperties event working fine, plus multiple OnTimer events. So far I've continued using scripttype=2 instead of OnPlay events though.
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
psyXonova
Posts: 785
Joined: Fri May 20, 2005 3:57 am
Location: Nicosia, Cyprus
Contact:

Post by psyXonova »

here is the code...

Code: Select all

Sub OnStartup
  Script.RegisterEvent SDB, "OnShutdown", "SDBShutdown"
  Script.RegisterEvent SDB, "OnTrackProperties", "SDBTrackProperties"
  Script.RegisterEvent SDB, "OnPlay", "SDBPlay"
  Script.RegisterEvent SDB, "OnPause", "SDBPause"
  Set Tmr = SDB.CreateTimer( 10000)   ' Pop up a message in 10 seconds
 Script.RegisterEvent Tmr, "OnTimer", "TestTimer"
End Sub

Sub SDBTrackProperties( tracks)
  SDB.MessageBox "Wow, track properties were modified for "&tracks.count&" track(s)!", mtInformation, Array(mbOk)
'  Script.UnregisterEvents SDB
End Sub

Sub SDBShutdown
  SDB.MessageBox "MediaMonkey is finishing... :(", mtInformation, Array(mbOk)
End Sub

Sub SDBPlay
  SDB.MessageBox "Started playback of "&SDB.Player.CurrentSong.ArtistName&_
    " - "&SDB.Player.CurrentSong.Title, mtInformation, Array(mbOk)
End Sub

Sub SDBPause
  If SDB.Player.isPaused Then
    SDB.MessageBox "Playback paused", mtInformation, Array(mbOk)
  End If
End Sub

Sub TestTimer( Timer)
  SDB.MessageBox "10 seconds elapsed!", mtInformation, Array(mbOk)
  Script.UnregisterEvents Timer  ' Terminate usage of this timer
End Sub
I am using latest beta....
I put is as test.vbs inside auto folder....

Only thing i can suspect is IE7 (which i have installed 2 months ago)....

EDIT:

Would a debug log help??
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

All of those work for me, and I'm using IE6 (well, Firefox 1.5 actually!) so maybe that is the problem.
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
jiri
Posts: 5433
Joined: Tue Aug 14, 2001 7:00 pm
Location: Czech Republic
Contact:

Post by jiri »

I don't see any reason why wouldn't the events work, maybe a debug log would make sense, although I'm not sure it will resolve the issue. Btw, I suppose you have tried it on a clear installation (without other plug-ins/scripts) and you are using the internal player.

Jiri
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

Although the OnTrackProperties event works for me, I think it is very limited. At the moment it is only triggered when you are using the properties window. What about tagging from Amazon or from scripts? The message appears at the bottom: "# tracks to be tagged", so MM must know the properties have been changed. Surely the event should be triggered in these cases too?
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
psyXonova
Posts: 785
Joined: Fri May 20, 2005 3:57 am
Location: Nicosia, Cyprus
Contact:

Post by psyXonova »

Jiri

After doing a clean install, all the events worked as they should. Seems like that all thoses updates with betas somehow "corrupted" the installation.
Anyway, i will start installing all my scripts one by one and if i discover that the problem was created by a script i will post it here for future reference.
Thanks again...
psyXonova
Posts: 785
Joined: Fri May 20, 2005 3:57 am
Location: Nicosia, Cyprus
Contact:

Post by psyXonova »

:o :( :o
Just discovered that the clean install was not necessary after all...
Seems like MMEvents can only be hooked by one Script.
To prove that i will described the procedure to replicate the problem.
After doing a clean install, first thing i did is created a test.vbs file and put it in the auto folder...
The code i used for this file was

Code: Select all

Sub OnStartup
  Script.RegisterEvent SDB, "OnShutdown", "SDBShutdown"
  Script.RegisterEvent SDB, "OnTrackProperties", "SDBTrackProperties"
  Script.RegisterEvent SDB, "OnPlay", "SDBPlay"
  Script.RegisterEvent SDB, "OnPause", "SDBPause"
  Set Tmr = SDB.CreateTimer( 1000)   ' Pop up a message in 10 seconds
 Script.RegisterEvent Tmr, "OnTimer", "TestTimer"
End Sub

Sub SDBTrackProperties( tracks)
  SDB.MessageBox "Wow, track properties were modified for "&tracks.count&" track(s)!", mtInformation, Array(mbOk)
'  Script.UnregisterEvents SDB
End Sub

Sub SDBShutdown
  SDB.MessageBox "MediaMonkey is finishing... :(", mtInformation, Array(mbOk)
End Sub

Sub SDBPlay
  SDB.MessageBox "Started playback of "&SDB.Player.CurrentSong.ArtistName&_
    " - "&SDB.Player.CurrentSong.Title, mtInformation, Array(mbOk)
End Sub

Sub SDBPause
  If SDB.Player.isPaused then
    SDB.MessageBox "Playback paused", mtInformation, Array(mbOk)
  End If
End Sub

Sub TestTimer(Tmr)
    Script.UnregisterEvents Tmr  ' Terminate usage of this Timer
SDB.MessageBox "10 seconds elapsed!", mtInformation, Array(mbOk)
End Sub
I started MM and everything was working as it should... by that i mean that all events were registered and the appropriate msgboxs popped out...

After that i install the StartupNode.vbs script, again inside the auto folder. I used the code from this topic.

I restarted MM. Both timers (from the 2 scripts) ran normally, but the other events from the test.vbs were not registered.
But the OnShutdown event was registered OK for Startupnode.vbs

I changed the filename for test.vbs to atest.vbs to force MM load it first.
Now, all events for atest.vbs were working, but only the timer was working for the Startupnode.vbs

I hope this will be fixed soon because those events are really useful and cant be blocked by only one script...
psyXonova
Posts: 785
Joined: Fri May 20, 2005 3:57 am
Location: Nicosia, Cyprus
Contact:

Post by psyXonova »

Tsssss :oops: :oops: :oops: :oops:

Ignore the last post of mine....
I was using 2.3.954

Just installed 2.3.959 and everything is working as it should...

Sorry about that ppl
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

Don't worry, it happens to the best of us! :)
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
Begges
Posts: 20
Joined: Fri Apr 28, 2006 3:52 pm
Location: Germany

Double Events behaviour

Post by Begges »

I have recognised that if i have two scripts in the auto folder which both call a Onshutdown Event only the first one (in alphebetical order) will be started on programm exit.
Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm

Post by Steegy »

Huh hummmmm...: http://www.mediamonkey.com/forum/viewto ... 4194#44194 (previous page of this thread)
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
DiddeLeeDoo
Posts: 1017
Joined: Wed Mar 01, 2006 1:09 am
Location: In a jungle down under
Contact:

Post by DiddeLeeDoo »

Although it maybe another silly one from me, I thought it was a bit interesting that when Roving Cowboy tested that very first version of AutoRating, he had conflicts with some other scripts.

I though simple, and changed every variable to unique name, and sent him this version, and he said it fixed the problem.

Basically the experience was 'keep it unique'... I'm not into events yet, but this factor that maybe should not be a factor, may actually be one.
Image
rovingcowboy
Posts: 14163
Joined: Sat Oct 25, 2003 7:57 am
Location: (Texas)
Contact:

Post by rovingcowboy »

the first coder i ever got help from for another program about 10 years ago told me his codes were always workable becuase he used his own wording.

at the time i did not know what he meant. but since i am starting to know a little more about coding i believe he was saying what diddeleedoo just said. keep it unique to that one code / script.

which makes me think that the windows scripting host engine is seeing one thing in a script as already running. so it does not start it again.

that is what i think is going on and just wanted to confirm / support,
diddeleedoo on what he said.


8)
roving cowboy / keith hall. My skins http://www.mediamonkey.com/forum/viewto ... =9&t=16724 for some help check on Monkey's helpful messages at http://www.mediamonkey.com/forum/viewto ... 4008#44008 MY SYSTEMS.1.Jukebox WinXp pro sp 3 version 3.5 gigabyte mb. 281 GHz amd athlon x2 240 built by me.) 2.WinXP pro sp3, vers 2.5.5 and vers 3.5 backup storage, shuttle 32a mb,734 MHz amd athlon put together by me.) 3.Dell demension, winxp pro sp3, mm3.5 spare jukebox.) 4.WinXp pro sp3, vers 3.5, dad's computer bought from computer store. )5. Samsung Galaxy A51 5G Android ) 6. amd a8-5600 apu 3.60ghz mm version 4 windows 7 pro bought from computer store.
Post Reply