natronicus
14th February 2008, 00:37
Hello all,
As mkv2vob does not have a batch processing mode, I hunted the internet to find a macro/scripting language that would automate this process for us. I found AutoHotKey (www.autohotkey.com).
The attached zip file contains the autohotkey script (so you can review/improve/modify the code if you wish) as well as a compiled .exe file for people who just want it to work.
When run, the script will:
1. Find mkv2vob. It looks in the same directory as the script first, but if it isn't found it will prompt you for the location of mkv2vob.
2. Ask you where your .mkv files are. It will recursively search through this folder and all subfolders for *.mkv files and queue them for processing.
3. Ask you where you would like your output .vob files located. (They will all be placed in the same folder. If you have two files in different folders with the same name, the first will be overwritten by the second. E.g., .\videoFile.mkv and .\directory\videoFile.mkv are two different files with the same name. Only one file will remain in the output file named videoFile.vob.)
4. Now that it has all the information needed, it will loop through the found files, running mkv2vob and supplying the input and output files as needed.
v 0.2.1 02/13/08: Added traytip and icon's tooltip to identify progress. Removed some unneeded variables.
v 0.2.0 02/13/08: Initial release.
The script file:
; Batch_mkv2vob.ahk v0.2.1 by natronicus
; Last updated: 02/13/08
; This script utilizes the macro/scripting language autohotkey. Visit
; www.autohotkey.com for documentation, example scripts, etc.
; This script automates usage of the mkv2vob program by 3r1c @ doom9. It recursively
; searches through a specified folder, generating a list of all .mkv files present,
; generates the output list of filenames (the previous list with .vob appended), starts
; mkv2vob with the first file, waits for the "Remuxing Complete" message, and
; starts over.
; This initial release is fairly "stupid" and does not handle errors at all. If a
; transcode fails, the script will hang. There is no resume if you cancel it
; halfway through. It will overwrite filenames without prompting.
; If the script hangs, right click the task bar icon and manually end the script. I did
; not extensively test this script. It likely has other issues with it that will cause
; it to fail.
; v 0.2.1 02/13/08: Added traytip and icon's tooltip to identify progress. Removed some
; unneeded variables.
; v 0.2 02/13/08: Initial release.
;-- Main Routine
gosub ObtainFolderLocs
gosub ObtainFileList
MsgBox, 4, Continue? (Press YES or NO), Files to convert:`n`n%FullPathFileList%`nContinue?
IfMsgBox Yes
gosub ProcessFileList
;MsgBox, ProcessFileList
Return
ObtainFolderLocs:
Mkv2vobLoc = ; init to null
FolderMKV =
FolderOutput =
IfExist, mkv2vob.exe
Mkv2vobLoc = %A_WorkingDir%\mkv2vob.exe
else
FileSelectFile, Mkv2vobLoc, 3,, Please select the location of mkv2vob.exe, mkv2vob executable (mkv2vob.exe)
FileSelectFolder, FolderMKV,, 3, Please select the folder where your .mkv files are located.
FileSelectFolder, FolderOutput, *%FolderMKV%, 3, Please select the folder where you would like the output .vob files placed.
Return
ObtainFileList:
; Obtain a file listing of .mkv files.
Loop, %FolderMKV%\*.mkv,, 1 ; The 1 turns on recursion
{
FullPathFileList = %FullPathFileList%%A_LoopFileFullPath%`n ; `n is the new line char
MkvCount = %A_Index%
}
Return
UpdateTray:
TrayTip, Batch mkv2vob processing..., Processing %NumFileConverting% of %MkvCount%.`n%varFileName%
SetTimer, RemoveTrayTip, 5000
Return
RemoveTrayTip:
SetTimer, RemoveTrayTip, Off
TrayTip
return
ProcessFileList:
; Loop through the file listing
FileOutputListing =
Loop, parse, FullPathFileList, `n ; We will use new line as the delimiter
{
if A_LoopField = ; Ignore the blank item at the end of the list.
continue
NumFileConverting = %A_Index%
varFileToConvert = %A_LoopField%
SplitPath, A_LoopField,varFileName,,, varFileNameNoExt
varFileOutput = %FolderOutput%\%varFileNameNoExt%.vob
FileOutputListing = %FileOutputListing%%varFileOutput%`n
gosub UpdateTray
Menu, tray, Tip, Batch mkv2vob processing... `n`nCurrently on %varFileName% (%NumFileConverting% of %MkvCount%)
gosub BatchMkv2vob
MsgBox, BatchMkv2vob process.
}
;ListVars
MsgBox,, %NumFileConverting% file(s) converted!, %FileOutputListing%
Return
BatchMkv2vob:
; Launch mkv2vob
Run %Mkv2vobLoc%
; Wait for it to start, activate the window, input varFileToConvert
WinWait, Select your MKV file,
IfWinNotActive, Select your MKV file, , WinActivate, Select your MKV file,
WinWaitActive, Select your MKV file,
Send, %varFileToConvert%{ENTER}
; Input varFullPathOutput
WinWait, Select destination VOB file,
IfWinNotActive, Select destination VOB file, , WinActivate, Select destination VOB file,
WinWaitActive, Select destination VOB file
Send, %varFileOutput%{ENTER}
; Select automatic transcoding.
WinWait, Conversion Options,
IfWinNotActive, Conversion Options, , WinActivate, Conversion Options,
WinWaitActive, Conversion Options,
MouseClick, left, 98, 137
WinWait, mkv2vob by 3r1c, Remuxing Complete
IfWinNotActive, mkv2vob by 3r1c, , WinActivate, mkv2vob by 3r1c,
WinWaitActive, mkv2vob by 3r1c,
MouseClick, left, 77, 95
Return
Click here (http://www.natronicus.com-a.googlepages.com/batch_mkv2vob_v0.2.1.zip) to download batch_mkv2vob_v0.2.1.zip containing:
batch_mkv2vob_v0.2.1.ahk
batch_mkv2vob_v0.2.1.exe
As mkv2vob does not have a batch processing mode, I hunted the internet to find a macro/scripting language that would automate this process for us. I found AutoHotKey (www.autohotkey.com).
The attached zip file contains the autohotkey script (so you can review/improve/modify the code if you wish) as well as a compiled .exe file for people who just want it to work.
When run, the script will:
1. Find mkv2vob. It looks in the same directory as the script first, but if it isn't found it will prompt you for the location of mkv2vob.
2. Ask you where your .mkv files are. It will recursively search through this folder and all subfolders for *.mkv files and queue them for processing.
3. Ask you where you would like your output .vob files located. (They will all be placed in the same folder. If you have two files in different folders with the same name, the first will be overwritten by the second. E.g., .\videoFile.mkv and .\directory\videoFile.mkv are two different files with the same name. Only one file will remain in the output file named videoFile.vob.)
4. Now that it has all the information needed, it will loop through the found files, running mkv2vob and supplying the input and output files as needed.
v 0.2.1 02/13/08: Added traytip and icon's tooltip to identify progress. Removed some unneeded variables.
v 0.2.0 02/13/08: Initial release.
The script file:
; Batch_mkv2vob.ahk v0.2.1 by natronicus
; Last updated: 02/13/08
; This script utilizes the macro/scripting language autohotkey. Visit
; www.autohotkey.com for documentation, example scripts, etc.
; This script automates usage of the mkv2vob program by 3r1c @ doom9. It recursively
; searches through a specified folder, generating a list of all .mkv files present,
; generates the output list of filenames (the previous list with .vob appended), starts
; mkv2vob with the first file, waits for the "Remuxing Complete" message, and
; starts over.
; This initial release is fairly "stupid" and does not handle errors at all. If a
; transcode fails, the script will hang. There is no resume if you cancel it
; halfway through. It will overwrite filenames without prompting.
; If the script hangs, right click the task bar icon and manually end the script. I did
; not extensively test this script. It likely has other issues with it that will cause
; it to fail.
; v 0.2.1 02/13/08: Added traytip and icon's tooltip to identify progress. Removed some
; unneeded variables.
; v 0.2 02/13/08: Initial release.
;-- Main Routine
gosub ObtainFolderLocs
gosub ObtainFileList
MsgBox, 4, Continue? (Press YES or NO), Files to convert:`n`n%FullPathFileList%`nContinue?
IfMsgBox Yes
gosub ProcessFileList
;MsgBox, ProcessFileList
Return
ObtainFolderLocs:
Mkv2vobLoc = ; init to null
FolderMKV =
FolderOutput =
IfExist, mkv2vob.exe
Mkv2vobLoc = %A_WorkingDir%\mkv2vob.exe
else
FileSelectFile, Mkv2vobLoc, 3,, Please select the location of mkv2vob.exe, mkv2vob executable (mkv2vob.exe)
FileSelectFolder, FolderMKV,, 3, Please select the folder where your .mkv files are located.
FileSelectFolder, FolderOutput, *%FolderMKV%, 3, Please select the folder where you would like the output .vob files placed.
Return
ObtainFileList:
; Obtain a file listing of .mkv files.
Loop, %FolderMKV%\*.mkv,, 1 ; The 1 turns on recursion
{
FullPathFileList = %FullPathFileList%%A_LoopFileFullPath%`n ; `n is the new line char
MkvCount = %A_Index%
}
Return
UpdateTray:
TrayTip, Batch mkv2vob processing..., Processing %NumFileConverting% of %MkvCount%.`n%varFileName%
SetTimer, RemoveTrayTip, 5000
Return
RemoveTrayTip:
SetTimer, RemoveTrayTip, Off
TrayTip
return
ProcessFileList:
; Loop through the file listing
FileOutputListing =
Loop, parse, FullPathFileList, `n ; We will use new line as the delimiter
{
if A_LoopField = ; Ignore the blank item at the end of the list.
continue
NumFileConverting = %A_Index%
varFileToConvert = %A_LoopField%
SplitPath, A_LoopField,varFileName,,, varFileNameNoExt
varFileOutput = %FolderOutput%\%varFileNameNoExt%.vob
FileOutputListing = %FileOutputListing%%varFileOutput%`n
gosub UpdateTray
Menu, tray, Tip, Batch mkv2vob processing... `n`nCurrently on %varFileName% (%NumFileConverting% of %MkvCount%)
gosub BatchMkv2vob
MsgBox, BatchMkv2vob process.
}
;ListVars
MsgBox,, %NumFileConverting% file(s) converted!, %FileOutputListing%
Return
BatchMkv2vob:
; Launch mkv2vob
Run %Mkv2vobLoc%
; Wait for it to start, activate the window, input varFileToConvert
WinWait, Select your MKV file,
IfWinNotActive, Select your MKV file, , WinActivate, Select your MKV file,
WinWaitActive, Select your MKV file,
Send, %varFileToConvert%{ENTER}
; Input varFullPathOutput
WinWait, Select destination VOB file,
IfWinNotActive, Select destination VOB file, , WinActivate, Select destination VOB file,
WinWaitActive, Select destination VOB file
Send, %varFileOutput%{ENTER}
; Select automatic transcoding.
WinWait, Conversion Options,
IfWinNotActive, Conversion Options, , WinActivate, Conversion Options,
WinWaitActive, Conversion Options,
MouseClick, left, 98, 137
WinWait, mkv2vob by 3r1c, Remuxing Complete
IfWinNotActive, mkv2vob by 3r1c, , WinActivate, mkv2vob by 3r1c,
WinWaitActive, mkv2vob by 3r1c,
MouseClick, left, 77, 95
Return
Click here (http://www.natronicus.com-a.googlepages.com/batch_mkv2vob_v0.2.1.zip) to download batch_mkv2vob_v0.2.1.zip containing:
batch_mkv2vob_v0.2.1.ahk
batch_mkv2vob_v0.2.1.exe