Scripting Functionality Thread (NO Script Requests Here!)

Download and get help for different MediaMonkey Addons.

Moderators: Peke, Gurus

Fellow scripters/coders/...: Do you feel the need for a wishlist for enhanced scripting functionality?

You may select 1 option

 
 
View results

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

Re: Scripting Functionality Thread (NO Script Requests Here!)

Post by trixmoto » Fri Aug 15, 2008 6:52 am

No, OnStop is fired when the stop button is clicked. The only way to do this currently would be to use the OnPlay and keep a note of the previous track each time. Of course this won't work for the very last track, so your request for a new event is probably necessary for this to work 100%.
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.

PartialGestalt

Re: Scripting Functionality Thread (NO Script Requests Here!)

Post by PartialGestalt » Fri Aug 15, 2008 4:39 pm

Thanks for the followup -- I guess I'll just stick to polling for now....

Peke
Posts: 13302
Joined: Tue Jun 10, 2003 7:21 pm
Location: Serbia
Contact:

Re: Scripting Functionality Thread (NO Script Requests Here!)

Post by Peke » Fri Aug 15, 2008 8:28 pm

@PartialGestalt
There is no dedicated Event for On TrackEnd But Here is how I solve that using Both Stop And Play.

Code: Select all

Public CacheTrackInfo
Set CacheTrackInfo = Null
Function  OnPlayStop
If Not (CacheTrackInfo = Null) Then
  ' First Do whatever it is needed to do on Track End
  CacheTrackInfo = Player.CurrentTrack
Else
  CacheTrackInfo = Player.CurrentTrack           
end if
End Function
that way it will always do function on last played track.
Best regards,
Pavle
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
Image
Image
How to add SCREENSHOTS to forum

MoDementia
Posts: 1321
Joined: Thu Jun 15, 2006 3:26 pm
Location: Geelong, Victoria, Australia

Re: Scripting Functionality Thread (NO Script Requests Here!)

Post by MoDementia » Wed Aug 27, 2008 1:32 am

Event to add custom menus to nodes
Although this has been discussed here I don't think it was added to this thread

MoDementia
Posts: 1321
Joined: Thu Jun 15, 2006 3:26 pm
Location: Geelong, Victoria, Australia

Re: Scripting Functionality Thread (NO Script Requests Here!)

Post by MoDementia » Thu Aug 28, 2008 9:24 pm

Access to the main track window column sorting criteria

My script can switch between sets of column postion / hidden/visible but their sort status is not available?

flashk
Posts: 188
Joined: Sun Dec 11, 2005 5:04 pm

Re:

Post by flashk » Tue Oct 14, 2008 11:50 pm

DaledeSilva wrote:in the wishlist, this is mentioned:

::SDBTracksWindow
Clear method

I too would like to be able to do SDB.MainTracksWindow.Clear

at the moment you can add tracks to the window WITHOUT moving to a new node.. and you can remove selected... but you can't create a completely new list WITHOUT moving to a new node.
What is the status on this? I would really like to have this functionality as well. I've also made an album art browsing docking panel and would like to fill the main tracks window with all the tracks of the selected album without having to jump to a node.

ZvezdanD
Posts: 3111
Joined: Thu Jun 08, 2006 7:40 pm

Re: Re:

Post by ZvezdanD » Wed Oct 15, 2008 8:45 am

flashk wrote:
DaledeSilva wrote:I too would like to be able to do SDB.MainTracksWindow.Clear
What is the status on this? I would really like to have this functionality as well.
How about:

Code: Select all

    Dim oShell
    Set oShell = CreateObject("WScript.Shell")
    oShell.SendKeys "^a"
    SDB.ProcessMessages
    SDB.MainTracksWindow.RemoveSelectedTracks
Magic Nodes 4.3.3 / 5.2 RegExp Find & Replace 4.4.9 / 5.2  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1.1 / 5.4.1  Expand Child Nodes/Expand All 1.1.2  Event Logger 2.7  Filtered Statistics Report 1.6  Track Redirection & Synchronization 3.4.2  Restore/Synchronize Database 3.1.8 / 4.0.1  Find Currently Playing Track 1.3.2  Queue List 1.2.1  Add to Library on Play 1.0.1  Tree Report for Child Nodes 1.1.1  Update Location of Files in Database 1.4.5 / 2.3  Inherit Child Playlists 1.0.3  Add Currently Playing/Selected Track(s) to Playlist 1.2

flashk
Posts: 188
Joined: Sun Dec 11, 2005 5:04 pm

Re: Re:

Post by flashk » Wed Oct 15, 2008 9:54 am

ZvezdanD wrote:How about:

Code: Select all

    Dim oShell
    Set oShell = CreateObject("WScript.Shell")
    oShell.SendKeys "^a"
    SDB.ProcessMessages
    SDB.MainTracksWindow.RemoveSelectedTracks
Thanks, but the MainTracksWindow will not have input focus when I want to to clear the list, so the Ctrl + A keystroke will not be sent to it. Having a Clear method, as many other people have requested, would be the easiest solution.

Bex
Posts: 6316
Joined: Fri May 21, 2004 5:44 am
Location: Sweden

Re: Scripting Functionality Thread (NO Script Requests Here!)

Post by Bex » Wed Oct 15, 2008 10:29 am

I haven't tried this but it should work if you go to a node which clears the MainWindow.
Something like:

Code: Select all

  SDB.MainTree.CurrentNode.NodeType = 12 'Library
  SDB.MainTracksWindow.Refresh
But I agree that we should have a proper Clear method
Advanced Duplicate Find & Fix Find More From Same - Custom Search. | Transfer PlayStat & Copy-Paste Tags/AlbumArt between any tracks.
Tagging Inconsistencies Do you think you have your tags in order? Think again...
Play History & Stats Node Like having your Last-FM account stored locally, but more advanced.
Case & Leading Zero Fixer Works on filenames too!

All My Scripts

ZvezdanD
Posts: 3111
Joined: Thu Jun 08, 2006 7:40 pm

Re: Re:

Post by ZvezdanD » Wed Oct 15, 2008 11:15 am

flashk wrote:Having a Clear method, as many other people have requested, would be the easiest solution.
Yeah, I agree, but there are many more important things in API that are waiting on a queue for a long time. Let's face it, MM developers don't listen scripters at all. When some of them answered to someone in this forum last time (beside of Peke who is also very rarely here)? When they are updated their API last time, beside of two or three not so very significant methods/properties? Here are only changes for several years: ActiveFilterQuery, GetFilterQuery, rather pathetic SDBUIMultiLineEdit and ... I think there is no more.
Magic Nodes 4.3.3 / 5.2 RegExp Find & Replace 4.4.9 / 5.2  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1.1 / 5.4.1  Expand Child Nodes/Expand All 1.1.2  Event Logger 2.7  Filtered Statistics Report 1.6  Track Redirection & Synchronization 3.4.2  Restore/Synchronize Database 3.1.8 / 4.0.1  Find Currently Playing Track 1.3.2  Queue List 1.2.1  Add to Library on Play 1.0.1  Tree Report for Child Nodes 1.1.1  Update Location of Files in Database 1.4.5 / 2.3  Inherit Child Playlists 1.0.3  Add Currently Playing/Selected Track(s) to Playlist 1.2

flashk
Posts: 188
Joined: Sun Dec 11, 2005 5:04 pm

Re: Scripting Functionality Thread (NO Script Requests Here!)

Post by flashk » Thu Oct 16, 2008 9:27 pm

Bex wrote:I haven't tried this but it should work if you go to a node which clears the MainWindow.
Something like:

Code: Select all

  SDB.MainTree.CurrentNode.NodeType = 12 'Library
  SDB.MainTracksWindow.Refresh
But I agree that we should have a proper Clear method
Thanks for the tip Bex! The code you posted works, but you need to restore the NodeType after adding the tracks to the window. Here is the final code I use to clear the main tracks window without jumping to a different node:

Code: Select all

' Save current node type
originalNodeType = SDB.MainTree.CurrentNode.NodeType

' Clear current tracks from window
SDB.MainTree.CurrentNode.NodeType = 12
SDB.MainTracksWindow.Refresh

' Add my own tracks
SDB.MainTracksWindow.AddTracksFromQuery "some query"
SDB.MainTracksWindow.FinishAdding

' IMPORTANT!! Restore original node type
SDB.MainTree.CurrentNode.NodeType = originalNodeType

twinbee
Posts: 180
Joined: Tue May 13, 2008 2:36 am
Location: England
Contact:

Re: Scripting Functionality Thread (NO Script Requests Here!)

Post by twinbee » Fri Oct 17, 2008 1:08 am

Ability to add add a track to SDBTracksWindow via song ID (instead of just ISDBSongData). It would work like AddTrackById for ISDBPlaylist.
MegaDJ v2 - Lightning fast and easy to use search to replace the standard AutoPlaylist. Features include random jukebox style playlists, along with syncing, weighting options, and logic complete querying.

Bex
Posts: 6316
Joined: Fri May 21, 2004 5:44 am
Location: Sweden

Re: Scripting Functionality Thread (NO Script Requests Here!)

Post by Bex » Fri Oct 17, 2008 2:18 am

@flashk,
Cool! :D

@twinbee,
That already possible:
SDB.MainTracksWindow.AddTracksFromQuery("WHERE Songs.ID=" & SongsID)
http://www.mediamonkey.com/wiki/index.p ... sFromQuery
Advanced Duplicate Find & Fix Find More From Same - Custom Search. | Transfer PlayStat & Copy-Paste Tags/AlbumArt between any tracks.
Tagging Inconsistencies Do you think you have your tags in order? Think again...
Play History & Stats Node Like having your Last-FM account stored locally, but more advanced.
Case & Leading Zero Fixer Works on filenames too!

All My Scripts

twinbee
Posts: 180
Joined: Tue May 13, 2008 2:36 am
Location: England
Contact:

Re: Scripting Functionality Thread (NO Script Requests Here!)

Post by twinbee » Fri Oct 17, 2008 4:20 am

That already possible:
SDB.MainTracksWindow.AddTracksFromQuery("WHERE Songs.ID=" & SongsID)
Wouldn't that be slower though, considering it has to scan through the whole database looking for the correct ID?

Then again, maybe that's what AddTrackById does anyway (I initially thought it was more direct). I imagine that adding through ISDBSongData will be much quicker in that case.
MegaDJ v2 - Lightning fast and easy to use search to replace the standard AutoPlaylist. Features include random jukebox style playlists, along with syncing, weighting options, and logic complete querying.

Bex
Posts: 6316
Joined: Fri May 21, 2004 5:44 am
Location: Sweden

Re: Scripting Functionality Thread (NO Script Requests Here!)

Post by Bex » Fri Oct 17, 2008 11:11 am

No, SDB.MainTracksWindow.AddTracksFromQuery() is the fastest way to add tracks to the main window, as long as you don't have slow SQL's.
Advanced Duplicate Find & Fix Find More From Same - Custom Search. | Transfer PlayStat & Copy-Paste Tags/AlbumArt between any tracks.
Tagging Inconsistencies Do you think you have your tags in order? Think again...
Play History & Stats Node Like having your Last-FM account stored locally, but more advanced.
Case & Leading Zero Fixer Works on filenames too!

All My Scripts

Post Reply