' 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 OpenInWinamp 
  ' 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 
