' Predixis MusicMagic Mixer Integration for Winamp ' ' beta 1 - Andy Baker (http://www.andybak.net - MMMAW@andybak.net) ' ' Requires Shane's ActiveWinamp plugin: http://activewinamp.sourceforge.net/ ' Save into your Active Winamp scripts folder as playlist_MusicMagic.vbs ' ' Currently hardcoded to look for MusicMagic 1.1 in the registry ' Requires licenced version of MMM with the API server turned on in options ' and set to listen on the default port (10002) Set http = CreateObject("Microsoft.XmlHttp") Set fso = CreateObject("Scripting.FileSystemObject") Set WshShell = CreateObject("WScript.Shell") query = "select * from Win32_Process where Name='MusicMagicMixer.exe'" Set wmiProcesses = GetObject("winmgmts:").ExecQuery(query) If wmiProcesses.count < 1 Then path = WshShell.RegRead ("HKLM\SOFTWARE\Predixis\MusicMagic Mixer\1.1\InstallDir") MMMapp = """" & path & "\MusicMagicMixer.exe""" WshShell.Run MMMapp, 7, False End if x = Playlist.GetSelection track = x(1).Filename http.open "GET", "http://localhost:10002/api/mix?song=" & URLEncode(track), FALSE http.send "" Playlist.Clear myArray = Split(http.responseText,vbLf, -1, vbtextcompare) For Each item in myArray set ps = LoadItem(CStr(item)) ps.enqueue Next Play quit Function URLEncode(text) Dim i, acode, char, translate translate = True URLEncode = text For i = Len(URLEncode) To 1 Step -1 acode = Asc(Mid(URLEncode, i, 1)) if (acode = 32) or (acode >= 48 and acode <= 57) or (acode >= 65 and acode <= 90) or (acode >= 97 and acode <= 122) Then translate = False End If if acode = 32 Then ' replace space with "+" URLEncode = Mid(URLEncode, 1, i-1) & "+" & Mid(URLEncode, i+1, len(URLEncode)) translate = False End If if translate = True Then ' replace punctuation chars with "%hex" URLEncode = Left(URLEncode, i - 1) & "%" & Hex(acode) & Mid(URLEncode, i + 1) End If Next End Function