New scripting features in MM 2.5.2

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

Moderators: Peke, Gurus

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

Post by trixmoto »

Couple of things I've picked up from other posts which would be useful:

1) An "OnTracksSynced" or similar event which allows you to run code after a sync.

2) Scripting access to the sleep function so it can be triggered programatically.

N.B. By "sleep function" I mean the MM one, not the VBScript one! :)
Last edited by trixmoto on Thu May 11, 2006 4:00 am, edited 1 time in total.
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 »

Steegy wrote:Huh hummmmm...: http://www.mediamonkey.com/forum/viewto ... 4194#44194 (previous page of this thread)
Yeah, i had seen this topic, but Jiri mentioned that it will be fixed in 2.3 and so i thought that 2.3.954 was OK.
Besides that i got use to see every new beta in its own topic, but now the things changed and i just realized that yersteday.
I accidentally scrolled down the new beta post and noticed that they were releases newer than 2.3.954...

Anyway, what can i I say, i guess everyone can have their bad moments.. LOL
psyXonova
Posts: 785
Joined: Fri May 20, 2005 3:57 am
Location: Nicosia, Cyprus
Contact:

Post by psyXonova »

Ok, found yet another one of those strange bugs... Pleas somebody verify this behavior....

use the code bellow as atest.vbs inside the Auto folder

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
yes it is the classic code i have been using for the past 3 posts... but everytime i discover another problem...

Ok, upon MM restart a timer pop up should come up...
Start playback, a pop up should come up. Modify any track except the one playing, a pop up should come up.
Modify the current playing track... a pop up should come up followed by 2 or 3 error messages "Error executing script event"....

What is the problem here???
I am trying to update the panel script in a way that it wont need any timers. I want it to update its contents whenever the playback starts or a track is modified.... but in the second case, the event is fire, panel is updated and then i have the same error message (but this time only once) with the one that the above code produces...
Plz verify that....
Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm

Post by Steegy »

@Jiri, Rusty

Is it possible to add also script related changes to the "Changes / What's new" list with new releases?

I sometimes have the same problem as Psxyonova mentions. To be sure that something about scripts is fixed / added, I sometimes have to search the forum, what is kind of a long way around.

Cheers
Steegy
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

I can confirm the bug, although I only get one error message!

I think some sort of history (probably only going back through 2.5 releases) to say what's been added and when. If not a past list, at least start one from now! :)
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 »

Ok, upon MM restart a timer pop up should come up...
Start playback, a pop up should come up. Modify any track except the one playing, a pop up should come up.
Modify the current playing track... a pop up should come up followed by 2 or 3 error messages "Error executing script event"....
This is indeed a bug and will be fixed. Thanks.
Is it possible to add also script related changes to the "Changes / What's new" list with new releases?
I'd like to better inform about scripting changes in the future versions. Possibly a special thread here would be good for this.

Jiri
onkel_enno
Posts: 2158
Joined: Fri Jan 14, 2005 1:45 am
Location: Germany
Contact:

Post by onkel_enno »

@Jiri
SDB.SongData.ParseText(...) doesn't work for the Artist, correct?
In the MainTracksWindows it is shown correctly after Parsing, but after refreshing, the Artist appeares untouched. For Title, ... it works well, thanks.

See http://www.mediamonkey.com/forum/viewto ... 6552#46552
Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm

Post by Steegy »

Scripting Functionality Wishlist wrote:Events should also work with built-in tree nodes, or there should be some other way of making the tree context menu adaptable to the tree node that is right-clicked (e.g. show additional context menu items for certain nodes)
Will this work after the "event-can-only-have-one-handler" problem has been fixed? Or does it already work?

Cheers
Steegy
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 »

Would it be an idea to add an OnIdle event, so certain events can simply create a 'to-do' list for whenever MM is idle, instead of doing it right away.

All in order to keep the speed up in MM
Image
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

I like the idea! :)

However, this would be complicated to manage because when the user started using MM again would you want to stop your idle event? You'd have to have some way of checking to see if MM was still idle in your loop so you could stop it maybe.
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.
DiddeLeeDoo
Posts: 1017
Joined: Wed Mar 01, 2006 1:09 am
Location: In a jungle down under
Contact:

Post by DiddeLeeDoo »

I believe there is an Idle status in the Windows System that can be retrieved.

The scripter needs to do a count down of the todo list for each item executed,

sketch

Code: Select all

DoneSoFar = 0

For i = 0 to ToDoList.Count-1
 If Idle then
   ToDoList.Task(i)
   DoneSoFar = DoneSoFar + 1
 Else
   Exit For
 End If
Next

ToDoList = ToDoList - DoneSoFar
Image
jiri
Posts: 5433
Joined: Tue Aug 14, 2001 7:00 pm
Location: Czech Republic
Contact:

Post by jiri »

@Jiri
SDB.SongData.ParseText(...) doesn't work for the Artist, correct?
In the MainTracksWindows it is shown correctly after Parsing, but after refreshing, the Artist appeares untouched. For Title, ... it works well, thanks.

See http://www.mediamonkey.com/forum/viewto ... 6552#46552
Please empty the artist name (and best of all any field you expect to be filled in) before the function is called (i.e. track.ArtistName="").

Jiri
onkel_enno
Posts: 2158
Joined: Fri Jan 14, 2005 1:45 am
Location: Germany
Contact:

Post by onkel_enno »

jiri wrote:Please empty the artist name (and best of all any field you expect to be filled in) before the function is called (i.e. track.ArtistName="").
Works like a charm. Thanks
Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm

Post by Steegy »

Hello.

Just to say that the "activex event handling" error from the first page ( http://www.mediamonkey.com/forum/viewto ... 5903#35903 ) is still here (MM 2.5.3 RC3).
I'm using a ListView ActiveX control now. The event is executed correctly, but gives 2 same "useless" script event error messages. Even with an empty event handler function, as shown below.

Image

Code: Select all

Script.RegisterEvent ListView.Interf, "ItemClick", "OnArtistSelect3"

Sub OnArtistSelect3(ListItem)    
End Sub
Cheers
Steegy
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
jiri
Posts: 5433
Joined: Tue Aug 14, 2001 7:00 pm
Location: Czech Republic
Contact:

Post by jiri »

Do you have a full script code to test?

Jiri
Post Reply