Option Explicit 'Ver 1.0, Rick G. Const Title = "Set Midi Volume" If WScript.Arguments.Count Then If IsNumeric(WScript.Arguments(0)) Then SetMidi WScript.Arguments(0) End If Else MsgBox "Argument: 0 - 100 required.",, Title End If Sub SetMidi(volume) ' requires wmp 7+ Dim f, o: Set o = CreateObject("WMPlayer.OCX") With CreateObject("Scripting.FileSystemObject") f = .BuildPath(.GetSpecialFolder(2), .GetTempName & ".mid") .CreateTextFile(f, 1).Write _ "MThd" & db("00 00 00 06 00 00 00 01 00 C0") & _ "MTrk" & db("00 00 00 09 86 00 90 47 00 00 FF 2F 00") o.URL = f ' open, wait while Transitioning Do: WScript.Sleep 100: Loop While o.playState = 9 ' setting now pertain to MIDI o.settings.volume = volume o.settings.balance = 0 o.close: .DeleteFile f End With End Sub Function db(s) ' debug in, binary out For Each s In Split(s): db = db & Chr("&h" & s): Next End Function