I'm trying to modify a vbscript for the MPEGplus audio encoder (something like MP3). I have the script on the desktop and when I drag-'n-drop wav files on it they get automatically compressed. Only thing is that the DOS-box closes immediately after the encoding is finished. But I don't want it to get closed automatically. This is the vbscript I use:
------------------------------------------------
' *** change path to your needs ***
path = "C:\Progs\Encoders\MP+\"
mppenc = "mppenc.exe"
' *** change default options to your needs ***
opts = "-forcewrite"
' no changes needed below this line
' #############################################
Dim wsh, args, infile, fs
title="MPEGplus Script"
' get input files
Set wsh = WScript.CreateObject("WScript.Shell"
Set args = WScript.Arguments
If args.Count = 0 Then
MsgBox "Please use drag & drop to specify input files.", vbInformation, title
WScript.Quit
End If
' check path
Set fs = CreateObject("Scripting.FileSystemObject"
If Not fs.FileExists(path & mppenc) Then
wsh.Popup "Could not find mppenc!" & vbCR & "(looked for '" & mppenc & "')", ,title, 16
WScript.Quit
End If
'process files
For i = 0 To args.Count-1
infile = args(i)
' check input file
If Not fs.FileExists(infile) Then
wsh.Popup "Error opening input-file" & vbCR & "'" & infile & "'", ,title, 16
Else
' run mppenc
ret = wsh.Run(CHR(34) & path & mppenc & CHR(34) & Chr(32) & Chr(34) & _
infile & Chr(34) & Chr(32) & opts, 1, True)
' diagnostics
Select Case ret
Case (-1)
MsgBox "mppenc aborted by user!", vbExclamation, title
Case (1)
MsgBox "Error returned by mppenc!" & vbCR & "(Check mppenc options and input file formats.)" & vbCR & "Used Options: " & opts, vbCritical, title
Case Else
Rem ignore
End Select
End If
Next
WScript.Quit
-----------------------------------------------------
So my question is: what must be changed to prevent the DOS-box from automaticaly closing? The OS is Win2k.
Thanx for your help!
Speek
------------------------------------------------
' *** change path to your needs ***
path = "C:\Progs\Encoders\MP+\"
mppenc = "mppenc.exe"
' *** change default options to your needs ***
opts = "-forcewrite"
' no changes needed below this line
' #############################################
Dim wsh, args, infile, fs
title="MPEGplus Script"
' get input files
Set wsh = WScript.CreateObject("WScript.Shell"
Set args = WScript.Arguments
If args.Count = 0 Then
MsgBox "Please use drag & drop to specify input files.", vbInformation, title
WScript.Quit
End If
' check path
Set fs = CreateObject("Scripting.FileSystemObject"
If Not fs.FileExists(path & mppenc) Then
wsh.Popup "Could not find mppenc!" & vbCR & "(looked for '" & mppenc & "')", ,title, 16
WScript.Quit
End If
'process files
For i = 0 To args.Count-1
infile = args(i)
' check input file
If Not fs.FileExists(infile) Then
wsh.Popup "Error opening input-file" & vbCR & "'" & infile & "'", ,title, 16
Else
' run mppenc
ret = wsh.Run(CHR(34) & path & mppenc & CHR(34) & Chr(32) & Chr(34) & _
infile & Chr(34) & Chr(32) & opts, 1, True)
' diagnostics
Select Case ret
Case (-1)
MsgBox "mppenc aborted by user!", vbExclamation, title
Case (1)
MsgBox "Error returned by mppenc!" & vbCR & "(Check mppenc options and input file formats.)" & vbCR & "Used Options: " & opts, vbCritical, title
Case Else
Rem ignore
End Select
End If
Next
WScript.Quit
-----------------------------------------------------
So my question is: what must be changed to prevent the DOS-box from automaticaly closing? The OS is Win2k.
Thanx for your help!
Speek