Script help
Moderators: Gurus, Addon Administrators
Script help
Hi,
I'm working on a script which creates a node. I want to add SDB.UI.Menu_Pop_Tree menu item which only is enabled if my new node (or its subnode) is selected. Is that possible? If it is, how do i do it?
I also want to add a Menu_Pop_TrackList menu which only is enabled if tracks from my nodes above is selected. Gues it's kind of same solution to the problem above.
I have searched the forum but without finding a solution...
I also wonder what these TreeNodeEvents are supposed to be used to:
- OnExecMenuItem
- OnExecTrackMenuItem
- OnShowMenuItem
- OnShowTrackMenuItem
They all have ItemIndex as parameter.
But what ItemIndex?
Actually, what is ItemIndex?
Help!
/Bex
I'm working on a script which creates a node. I want to add SDB.UI.Menu_Pop_Tree menu item which only is enabled if my new node (or its subnode) is selected. Is that possible? If it is, how do i do it?
I also want to add a Menu_Pop_TrackList menu which only is enabled if tracks from my nodes above is selected. Gues it's kind of same solution to the problem above.
I have searched the forum but without finding a solution...
I also wonder what these TreeNodeEvents are supposed to be used to:
- OnExecMenuItem
- OnExecTrackMenuItem
- OnShowMenuItem
- OnShowTrackMenuItem
They all have ItemIndex as parameter.
But what ItemIndex?
Actually, what is ItemIndex?
Help!
/Bex
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
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
You're not the only scripter wanting this (I officially know 4): http://www.mediamonkey.com/forum/viewto ... 8404#38404Bex wrote:...I want to add SDB.UI.Menu_Pop_Tree menu item which only is enabled if my new node (or its subnode) is selected....
I'll let an other scripter answer your 2nd question as I can't help very much (I try the events I think I need before using them in a script).
Cheers
Steegy
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
Ok thanks Steegy. I hope Jiri add this function in next version.
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
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
I actually solved it!
At least I think I did. I involved the OnChangedSelection event to change the visibility of the menu.
It seems to work just fine. Do anyone see any potential errors/drawbacks?
Here's what I did:
Edit: code edited
At least I think I did. I involved the OnChangedSelection event to change the visibility of the menu.
It seems to work just fine. Do anyone see any potential errors/drawbacks?
Here's what I did:
Code: Select all
' Example code to on how make own menu entries Visible/Not Visible based on what node is selected
Sub onstartup
Dim Tree : Set Tree = SDB.MainTree
Dim Node : Set Node = Tree.CreateNode
Node.Caption = "Test Node"
Node.IconIndex = 47
Node.CustomNodeId = 1111 'Must not already exist
Tree.AddNode Tree.Node_Library, Node, 1
' Add a menu entry to the Pop tree menu in main window
Dim mnu
Set Mnu = SDB.UI.AddMenuItem( SDB.UI.Menu_Pop_Tree , -1, 1)
Mnu.Caption = "&Test Menu"
Mnu.IconIndex = 9
Mnu.UseScript=Script.ScriptPath
Script.RegisterEvent SDB, "OnChangedSelection", "FixMnuVisible"
SDB.Objects("Mnu") = Mnu
SDB.Objects("Mnu").Visible = False
end sub
sub FixMnuVisible
dim myNode
Set myNode = SDB.MainTree.CurrentNode
if myNode.CustomNodeId = 1111 Then
SDB.Objects("Mnu").Visible = True
else
SDB.Objects("Mnu").Visible = False
end if
End sub
Last edited by Bex on Mon Oct 23, 2006 9:13 am, edited 1 time in total.
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
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
If that works (it looks good), then we must have overlooked the fact that this new event OnChangedSelection solves this problem
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
I would recommend using CustomNodeId instead of NodeType as the custom properties are designed for this kind of thing. Great workaround! I've used this method with toolbar buttons but it never occurred to me to try it with popup menu items!
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.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
Thanks guys!
But if you create a popup menu item which you want to display in a regular node then you need to use NodeType, don't you? (e.g. psyxonovas merge playlists)
Must have missed that script with the toolbar workaround, which is it?
But if you create a popup menu item which you want to display in a regular node then you need to use NodeType, don't you? (e.g. psyxonovas merge playlists)
Must have missed that script with the toolbar workaround, which is it?
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
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
It's not been released because it is a custom script someone has requested, and it's not finished yet.
It's probably ok to use NodeType, but as this value is used internally it's not something I'd change myself, as I don't know what internall it is used for.
It's probably ok to use NodeType, but as this value is used internally it's not something I'd change myself, as I don't know what internall it is used for.
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.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
Trixmoto is right. Maybe CustomNodeID is better.
Here's how NodeType is used: http://home.tiscali.be/ruben.castelein/ ... eTypes.txt (e.g. good to recognise Custom Nodes).
So if you use NodeType, make sure it's > 255.
Here's how NodeType is used: http://home.tiscali.be/ruben.castelein/ ... eTypes.txt (e.g. good to recognise Custom Nodes).
So if you use NodeType, make sure it's > 255.
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
Yes, it's probably better to use CustomNodeID on custom nodes but to id regular nodes you must use NodeType because they dont have a CustomNodeID, do they?
I've already studied your great map of NodeType values (along with the other helpfull tips on the script resource page) but thanks anyway!
Another thing. Has any of you used OnNodeDragDrop in a script which I can study?
Pablo has used it in Magic Nodes but I have problems to understand how that script is working
I still have a lot to learn with vbscript, as you can see in my messy codes, so I greatfully receive any tips/help I can get!
I've already studied your great map of NodeType values (along with the other helpfull tips on the script resource page) but thanks anyway!
Another thing. Has any of you used OnNodeDragDrop in a script which I can study?
Pablo has used it in Magic Nodes but I have problems to understand how that script is working
I still have a lot to learn with vbscript, as you can see in my messy codes, so I greatfully receive any tips/help I can get!
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
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
Ok guys, I can confirm that it is a very bad idea to assign a NodeType value to a custom nodes since it gives strange unwanted behaviour to the node...
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
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
I feared it might!
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.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.