Function CallQuickTime(Path)
Dim fso, mp4, mp5, c, Car, QT, Str
Set fso = CreateObject("Scripting.FileSystemObject")
Set WshShell = WScript.CreateObject("WScript.Shell")
Str = ""
For c = 1 To Len(Path) 'Convert 1 \ in 2 \
If Mid(Path, c, 1) = "\" Then
Str = Str & "\\"
Else
Str = Str & Mid(Path, c, 1)
End If
Next
mp4 = Left(Path, Len(Path)-3) & "mp4"
' get filename.wav by Zeer
For c = 1 To Len(Path)
If Mid(Path, c, 1) = "\" Then
wavx=c
Else
End If
Next
wav=Right(Path,Len(Path)-wavx)
wav=Left(wav,Len(Path)-3)
Path = Chr(34) & Str & Chr(34)
QT = Chr(34) & "C:\\Program Files\\QuickTime\\QuickTimePlayer.exe " & Chr (34)
WshShell.Run(QT & Path)
WScript.Sleep 3000
Do 'Loop until the mp4 file really exists
WshShell.AppActivate(wav)
WScript.Sleep 1500
WshShell.SendKeys "%FE" 'File Export, could be "^E"
WScript.Sleep 500
WshShell.SendKeys ("C:\Temp.mp4") 'Temporary mp4 filename
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 8000
'Check to see if the temp file is still here
While fso.FileExists ("C:\Temp.mp5")
WScript.Sleep 2000 'With CScript.exe instead of WScript.exe I could put 500
'IMPORTANT : Increase the value under slower systems (.wav already exists bug)
Wend
'The Enter was added in case QuickTime says .wav file already exists, to clear the error.
'It launches playing if all goes well.
WScript.Sleep 500
WshShell.AppActivate(wav)
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ESC}"
WScript.Sleep 500
Loop Until fso.FileExists("C:\Temp.mp4")
'Close QuickTime
WshShell.AppActivate(wav)
WScript.Sleep 500
WshShell.SendKeys "{ESC}"
WScript.Sleep 500
WshShell.SendKeys "%FX"
WScript.Sleep 2000 'A little wait to let QuickTime exit before returning to EAC
' If not EAC could not be able to rename the wav file to original, then delete it.
'IMPORTANT : Increase the value under slower systems (files do not regain their original names bug)
'Added part here for tagging the mp4.
Tagger = Chr(34) & "C:\\SAVE\\tg.exe " & Chr (34)
TagParams = "C:\Temp.mp4" & " --artist " & Artist & " --album " & Album & " --title " & Title & " --track " & Track & " --genre " & Genre & " --year " & CDYear
WshShell.Run(Tagger & TagParams)
'Wait some seconds for tagging to occur.
WScript.Sleep 3000
'Move the Temp.mp4 to the right place while renaming it
fso.MoveFile "C:\Temp.mp4" , mp4
Set fso = Nothing
End Function
'Get the 8 first arguments and assumes they are %s %d "%a" "%g" "%t" %n "%m" %y
'(source, destination, Artist, Album, Title, Track number, Genre, Year In EAC)
Dim wav
Set objArgs = WScript.Arguments
wav = objArgs(0)
mp4 = objArgs(1)
Artist = Chr(34) & objArgs(2) & Chr(34)
Album = Chr(34) & objArgs(3) & Chr(34)
Title = Chr(34) & objArgs(4) & Chr(34)
Track = objArgs(5)
Genre = Chr(34) & objArgs(6) & Chr(34)
CDYear = objArgs(7)
CallQuickTime(wav)
Wscript.Quit