User defined action
User defined action
As suggested I immediately uprgaded to MediaMonkey Gold and now I'm asking for help.
I need a script which launches the external application (in my case a sound file editor) with the path to currently selected MP3 file.
I'm currently browsing though MSDN searching for any clues how to achive that goal - probably through WScript.Shell object's run method - but I'm not too familiar with VBScript.
My MediaMonkey (build 1.543) doesn't display any scripts menu - is that okay? Songs-DB displays scripts menu therefore I can use them.
Any help appreciated.
I need a script which launches the external application (in my case a sound file editor) with the path to currently selected MP3 file.
I'm currently browsing though MSDN searching for any clues how to achive that goal - probably through WScript.Shell object's run method - but I'm not too familiar with VBScript.
My MediaMonkey (build 1.543) doesn't display any scripts menu - is that okay? Songs-DB displays scripts menu therefore I can use them.
Any help appreciated.
Ok, an easy version of the script could look like:
Sub OpenInWinamp
Dim WShell, Command, list, itm
Set list = SDB.SelectedSongList
If list.count=0 Then
Exit Sub
End If
Set itm = list.Item(0)
Set WShell = CreateObject("WScript.Shell")
Command = Chr(34)&"C:\Program Files\Winamp\winamp.exe"&Chr(34) &" "&Chr(34)&itm.Path&Chr(34)
WShell.Run Command, 1, 0
End Sub
This script simply opens selected track in WinAmp (providing paths are correct).
An entry in scripts.ini could be
[OpenInWinamp]
FileName=MyScripts.vbs
ProcName=OpenInWinamp
Order=1
DisplayName=Open file in WinAmp
Description=Open file in WinAmp
Language=VBScript
ScriptType=0
The important thing is the last line: 'ScriptType=0', because then the script will appear in Tools|Scripts (which is by default invisible, only visible when such script exists). Otherwise is appears in Export scripts.
Hope it helps,
Jiri
Sub OpenInWinamp
Dim WShell, Command, list, itm
Set list = SDB.SelectedSongList
If list.count=0 Then
Exit Sub
End If
Set itm = list.Item(0)
Set WShell = CreateObject("WScript.Shell")
Command = Chr(34)&"C:\Program Files\Winamp\winamp.exe"&Chr(34) &" "&Chr(34)&itm.Path&Chr(34)
WShell.Run Command, 1, 0
End Sub
This script simply opens selected track in WinAmp (providing paths are correct).
An entry in scripts.ini could be
[OpenInWinamp]
FileName=MyScripts.vbs
ProcName=OpenInWinamp
Order=1
DisplayName=Open file in WinAmp
Description=Open file in WinAmp
Language=VBScript
ScriptType=0
The important thing is the last line: 'ScriptType=0', because then the script will appear in Tools|Scripts (which is by default invisible, only visible when such script exists). Otherwise is appears in Export scripts.
Hope it helps,
Jiri
Start Of External Programs
I'm Developing An App that will be a third party Program which will make that script and manage existen, Stay tunned )
Best regards,
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
How to attach PICTURE/SCREENSHOTS to forum posts
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
How to attach PICTURE/SCREENSHOTS to forum posts
I do not know what you R talking about?
Best regards,
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
How to attach PICTURE/SCREENSHOTS to forum posts
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
How to attach PICTURE/SCREENSHOTS to forum posts
Talking to yourself?
Peke are you talking to yourself again? You've got to quit working so hard.
Sorry Those two msgs are mentioned for for 2 different Topics I do not know how this happend, but sure. Can I take vocation and leave unfinished bisnis
Best regards,
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
How to attach PICTURE/SCREENSHOTS to forum posts
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
How to attach PICTURE/SCREENSHOTS to forum posts
Here is a modification in Jiri's script to allow the user to send to winamp from the "send to" menu in either the Track List or the Playing Now panes.
I am using code snippets from Peke script to make it work, but the new script is simple and small, and uses winamp instead of a custom exe file (which was the case in Peke's original script)
To install copy the code into a text file and place it in the Scripts/Auto under your media monkey folder.
I am using code snippets from Peke script to make it work, but the new script is simple and small, and uses winamp instead of a custom exe file (which was the case in Peke's original script)
Code: Select all
' A simple script that shows how to open a selected track in another application.
' In this case it is WinAmp (expected to be in C:\Program Files\Winamp\winamp.exe).
Const WinAmpPath = "C:\Program Files\Winamp\winamp.exe"
Sub OnStartup
Dim POPSMonitor
Set POPSMonitor = SDB.UI.AddMenuItem(SDB.UI.Menu_Pop_TrackList_SendTo,0,0)
POPSMonitor.Caption = "Send to Winamp"
POPSMonitor.OnClickFunc = "OpenInWinampNew"
POPSMonitor.UseScript = Script.ScriptPath
POPSMonitor.IconIndex = 40
Set POPSMonitor = SDB.UI.AddMenuItem(SDB.UI.Menu_Pop_NP_SendTo,0,0)
POPSMonitor.Caption = "Send to Winamp"
POPSMonitor.OnClickFunc = "OpenInWinampNew"
POPSMonitor.UseScript = Script.ScriptPath
POPSMonitor.IconIndex = 40
Dim POPSPreview
Set POPSPreview = SDB.UI.AddMenuItem(SDB.UI.Menu_Pop_TrackList_SendTo,0,0)
POPSPreview.Caption = "Send Preview to Winamp"
POPSPreview.OnClickFunc = "OpenInWinampPreview"
POPSPreview.UseScript = Script.ScriptPath
POPSPreview.IconIndex = 18
Set POPSPreview = SDB.UI.AddMenuItem(SDB.UI.Menu_Pop_NP_SendTo,0,0)
POPSPreview.Caption = "Send Preview to Winamp"
POPSPreview.OnClickFunc = "OpenInWinampPreview"
POPSPreview.UseScript = Script.ScriptPath
POPSPreview.IconIndex = 18
End Sub
Sub OpenInWinampPreview (arg)
Dim WShell, Command, Song
If SDB.SelectedSongList.item(0).Preview = 0 Then
Result = SDB.MessageBox( "Selected Track do not have Preview.", mtError, Array(mbOk))
Exit sub
END IF
Set Song = SDB.SelectedSongList.item(0)
Set WShell = CreateObject("WScript.Shell")
Command = Chr(34) & WinAmpPath & Chr(34) & " " & Chr(34) & Song.PreviewPath & Chr(34)
WShell.Run Command, 1, 0
End Sub
Sub OpenInWinampNew (arg)
' Define variables
Dim WShell, Command, list, itm
' Get list of selected tracks from MediaMonkey
Set list = SDB.SelectedSongList
' Make sure at least one track is selected
If list.count=0 Then
Exit Sub
End If
' Get the first selected track
Set itm = list.Item(0)
' Prepare WScript.Shell object, which can be used for execution of applications
Set WShell = CreateObject("WScript.Shell")
' Prepare command to execute
Command = Chr(34) & WinAmpPath & Chr(34) & " " & Chr(34) & itm.Path & Chr(34)
' And execute the command
WShell.Run Command, 1, 0
End Sub
Code: Select all
And what must I do to open not only the first title of some selected tracks but all?
The most reliable script for me is ExportM3UAndPlayInWinamp ( http://www.mediamonkey.com/forum/viewtopic.php?t=6566 ). It doesn't crash Winamp when large amounts of tracks are copied, like other scripts cause. (that's why I made this script...)
Cheers
Steegy
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
Use the File object of the FileSystemObject to get the folder path. If you don't want to use this (or want a faster way), you can use InstrRev to search that path separator '\' and then take the part of the string before that position (using the Left function).what must I do then if I want to hand over not the whole name of the file to an external program, but only the path of the file?
The code is very simple, but I don't completely know these functions by heart, so maybe you can do some useful reserach for your own (http://msdn.microsoft.com/scripting --> scripting reference: VbScript)
Cheers
Steegy
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
I'm trying to modify this script to run another app rather than Winamp.
specifically: a tag editor called Mp3edit that has some more advanced tagging and renaming features.
i want to select a group of files, then "Send to Mp3edit" to mass edit and rename tags .... i dont need a "Send Preview to Mp3edit" obviously, so im trying to delete that from the script
I have the script modified here - mainly just using a simple replace 'winamp' with 'mp3edit' and removing the subs for the preview function
seems to load fine - puts the menu item in "Send To"... but gives me the following error boxes when i try and send files:
"Error # -
File://[path]/OpenWA.vbs, line: 75, Column: 2" {this is last line in script]
OK .. then ...
"Error happened during script, the system can not find the file specified"
Obviously i dont need a "Send Preview to Mp3edit", so id like to remove that too ... but for now it would be enough just to get this to send to my application so i can work
Anybody? Its probably simple but i dont know VBscript and cant find the error ... script below ... does this require an INI modification too? because im not sure how that fits in here either ...
thanks, much appreciated .........
---
specifically: a tag editor called Mp3edit that has some more advanced tagging and renaming features.
i want to select a group of files, then "Send to Mp3edit" to mass edit and rename tags .... i dont need a "Send Preview to Mp3edit" obviously, so im trying to delete that from the script
I have the script modified here - mainly just using a simple replace 'winamp' with 'mp3edit' and removing the subs for the preview function
seems to load fine - puts the menu item in "Send To"... but gives me the following error boxes when i try and send files:
"Error # -
File://[path]/OpenWA.vbs, line: 75, Column: 2" {this is last line in script]
OK .. then ...
"Error happened during script, the system can not find the file specified"
Obviously i dont need a "Send Preview to Mp3edit", so id like to remove that too ... but for now it would be enough just to get this to send to my application so i can work
Anybody? Its probably simple but i dont know VBscript and cant find the error ... script below ... does this require an INI modification too? because im not sure how that fits in here either ...
thanks, much appreciated .........
---
' A simple script that shows how to open a selected track in another application.
' In this case it is Mp3edit (expected to be in C:\Program Files\Mp3edit\Mp3edit.exe).
Const Mp3editPath = "C:\Program Files\Mp3edit\Mp3edit.exe"
Sub OnStartup
Dim POPSMonitor
Set POPSMonitor = SDB.UI.AddMenuItem(SDB.UI.Menu_Pop_TrackList_SendTo,0,0)
POPSMonitor.Caption = "Send to Mp3edit"
POPSMonitor.OnClickFunc = "OpenInMp3editNew"
POPSMonitor.UseScript = Script.ScriptPath
POPSMonitor.IconIndex = 40
Set POPSMonitor = SDB.UI.AddMenuItem(SDB.UI.Menu_Pop_NP_SendTo,0,0)
POPSMonitor.Caption = "Send to Mp3edit"
POPSMonitor.OnClickFunc = "OpenInMp3editNew"
POPSMonitor.UseScript = Script.ScriptPath
POPSMonitor.IconIndex = 40
End Sub
Sub OpenInMp3editNew (arg)
' Define variables
Dim WShell, Command, list, itm
' Get list of selected tracks from MediaMonkey
Set list = SDB.SelectedSongList
' Make sure at least one track is selected
If list.count=0 Then
Exit Sub
End If
' Get the first selected track
Set itm = list.Item(0)
' Prepare WScript.Shell object, which can be used for execution of applications
Set WShell = CreateObject("WScript.Shell")
' Prepare command to execute
Command = Chr(34) & Mp3editPath & Chr(34) & " " & Chr(34) & itm.Path & Chr(34)
' And execute the command
WShell.Run Command, 1, 0
End Sub
The script works perfectly for me. Presumably either the location is incorrect, or you do not have the most recent WScript version (5.6) - maybe try downloading that from microsoft.com
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.
are you saying you tried my script modification out the way i just listed it, and its working for you?trixmoto wrote:The script works perfectly for me. Presumably either the location is incorrect, or you do not have the most recent WScript version (5.6) - maybe try downloading that from microsoft.com
.