You Sir, are my hero!
I will pass on the subler way, because it uses a GUI.
But I will try to use the C code on my windows box.
The reason I want to use a Windows machine to encode is because my fastest Mac OS machine is a PowerMac G4 450dp and the Windows machine is a Core2Duo.
If there is an alternative to Vroksub (A subtitle downloader for opensubtitles.org) I want to switch the rest of the handling to my Mac machines.
This is what I have so far on my Windows Server (my Mac os knowledge isn't enough to come with a equivalent
------------------------
Convert.bat
::Set variables
set MP4BOX=d:\conversion\tools\MP4Box.exe
set VROKSUB=d:\conversion\tools\VrokSub.exe
set SED=d:\conversion\tools\sed\bin\sed.exe
set HANDBRAKE=d:\conversion\tools\HandBrakeCLI.exe
set WINRAR=C:\Progra~1\WinRAR\winrar.exe
set ATOMIC=d:\conversion\tools\AtomicParsley.exe
::Lock the conversion
IF EXIST d:\CONVERSION\lock.txt GOTO END
copy d:\CONVERSION\lockfile\lock.txt d:\CONVERSION\lock.txt
::Copy all Downloaded files and unpack the rars
::Move files to D:\downloaded\
D:\
MOVE D:\bittorrent\done\*.* D:\downloaded\
cd D:\downloaded\
::Unrar Downloaded files - var %%r and delete the rars
for /f %%r IN ('dir /b /s *.rar') do call start /wait cmd /c "%WINRAR% X -o+ %%r"
DEL /q /S *.r??
D:
cd D:\downloaded\
:

elete the sample movies
del /s /q *sample*.*
::Sort movies by type
::Move The TV Shows into the conversion directory per show
for /f %%a IN ('dir /b /s *bones*.avi') do call start /wait cmd /c "move %%a D:\video\avi\tvshows\bones\unsubbed\"
::Move AVI files into the conversion directory
for /f %%b IN ('dir /b /s *.avi') do call start /wait cmd /c "move %%b D:\video\avi\unsubbed\"
::Move MKV files into the conversion directory
for /f %%c IN ('dir /b /s *.mkv') do call start /wait cmd /c "move %%c D:\video\mkv\unsubbed\"
::Find subtitles
::Find subtitles for the TV Shows
start /wait "%VROKSUB% "D:\video\avi\tvshows\bones\unsubbed" nl /move="D:\video\avi\tvshows\bones\subbed""
::Find subtitles for the avi's
start /wait "%VROKSUB% "D:\video\avi\unsubbed" nl /move="D:\video\avi\subbed""
::Find subtitles for the mkv's
start /wait "%VROKSUB% "D:\video\mkv\unsubbed" nl /move="D:\video\mkv\subbed""
::rename nl named files to usable files - var %%d
cd D:\video\
for /f %%d IN ('dir /b /s *.avi') do call start /wait cmd /c "rename %%~nd.nl.srt %%~nd.srt"
::Convert Srt to TTXT - var %%e %%f %%g
::Bones
cd D:\video\avi\tvshows\bones\subbed\
for /f %%e IN ('dir /b /s *.srt') do call start /wait cmd /c ""%MP4BOX%" -ttxt "%%e""
move *.ttxt e:\convert\tvshows\subbing\
DEL /q *.srt
::AVI
cd D:\video\avi\subbed\
for /f %%f IN ('dir /b /s *.srt') do call start /wait cmd /c ""%MP4BOX%" -ttxt "%%f""
move *.ttxt e:\convert\avi\subbing\
DEL /q *.srt
::MKV
cd D:\video\mkv\subbed\
for /f %%g IN ('dir /b /s *.srt') do call start /wait cmd /c ""%MP4BOX%" -ttxt "%%g""
move *.ttxt e:\convert\mkv\subbing\
DEL /q *.srt
::Conversion LOOP for Subtitled Movie files
:CONVERT
IF EXIST D:\video\avi\tvshows\bones\subbed\*bones*.avi GOTO BONES
IF EXIST D:\video\avi\subbed\*.avi GOTO AVI
IF EXIST D:\video\avi\subbed\*.avi GOTO MKV
IF EXIST D:\video\DVD\*.* GOTO DVD
DEL d:\CONVERSION\lock.txt
GOTO END
::Convert the TV Show Bones, Add iTunes Episode information and finish it
:BONES
::Handbrake converts SUBBED AVI to M4V without chapters - var %%a
d:
cd D:\video\avi\tvshows\bones\subbed\
for /f %%a IN ('dir /b *.avi') do call start /wait cmd /c ""%HANDBRAKE%" -i "%%a" -t 1 -c 1 -o "e:\convert\tvshows\subbing\%%~na.m4v" -f m4v -4 -X 960 -P -e x264 -q 0.59 -2 -T -a 1,1 -E faac,ac3 -B 160 -R 48,0 -6 dpl2,dpl2 -D 1,1 -x level=30:cabac=0:ref=3:mixed-refs=1:bframes=6:weightb=1:direct=auto:no-fast-pskip=1:me=umh:subq=7:analyse=all -v"
DEL /q *.*
::mux ttext into m4v - var %%h
e:
cd e:\convert\tvshows\subbing\
for /f %%h IN ('dir /b *.m4v') do call start /wait cmd /c ""%MP4BOX%" -add "%%~nh.ttxt":lang=nld "%%h""
::Rename TV Show to usable format
e:
CD e:\convert\tvshows\finished\
::Rename file for further processing - Bones.S04E14.HDTV.XviD-LOL.m4v to Bones-04-14.m4v
for /f "tokens=1,2,3,4* delims=.SE" %%a IN ('dir /b *.m4v') do rename %%a.S%%bE%%c.%%d*.m4v %%a-%%b-%%c.m4v
::Goto working directory
d:
CD e:\convert\tvshows\finished\
::Set iTunes Atoms
for /f "tokens=1,2,3 delims=-." %%a IN ('dir /b *.m4v') do %ATOMIC% %%a-%%b-%%c.m4v --stik "TV Show" --genre "TV Shows" --TVShowName "%%a" --TVSeasonNum "%%b" --TVEpisodeNum "%%c" --TVEpisode "%%b%%c" --artwork d:\conversion\art\bones\bones.jpg"
move *.m4v e:\convert\tvshows\finished\
DEL /q e:\convert\tvshows\subbing\*.*
GOTO CONVERT
:AVI
::Handbrake converts SUBBED AVI to M4V without chapters - var %%a
d:
cd D:\video\avi\subbed\
for /f %%a IN ('dir /b *.avi') do call start /wait cmd /c ""%HANDBRAKE%" -i "%%a" -t 1 -c 1 -o "e:\convert\avi\subbing\%%~na.m4v" -f m4v -4 -X 960 -P -e x264 -q 0.59 -2 -T -a 1,1 -E faac,ac3 -B 160 -R 48,0 -6 dpl2,dpl2 -D 1,1 -x level=30:cabac=0:ref=3:mixed-refs=1:bframes=6:weightb=1:direct=auto:no-fast-pskip=1:me=umh:subq=7:analyse=all -v"
DEL /q *.avi
::mux ttext into m4v - var %%i
e:
cd e:\convert\avi\subbing\
for /f %%i IN ('dir /b *.m4v') do call start /wait cmd /c ""%MP4BOX%" -add "%%~ni.ttxt":lang=nld "%%i""
move *.m4v e:\convert\avi\finished\
DEL /q e:\convert\avi\subbing\*.*
GOTO CONVERT
:MKV
d:
::Handbrake converts subbed MKV to M4V without chapters - var %%a
cd D:\video\mkv\subbed\
for /f %%a IN ('dir /b *.mkv') do call start /wait cmd /c ""%HANDBRAKE%" -i "%%a" -t 1 -c 1 -o "e:\convert\avi\subbing\%%~na.m4v" -f m4v -4 -X 960 -P -e x264 -q 0.59 -2 -T -a 1 -E faac -B 160 -R 48 -6 dpl2 -D 1 -x level=30:cabac=0:ref=3:mixed-refs=1:bframes=6:weightb=1:direct=auto:no-fast-pskip=1:me=umh:subq=7:analyse=all -v"
DEL /q *.mkv
::mux ttext into m4v - var %%j
e:
cd e:\convert\mkv\subbing\
for /f %%j IN ('dir /b *.m4v') do call start /wait cmd /c ""%MP4BOX%" -add "%%~nj.ttxt":lang=nld "%%j""
move *.m4v e:\convert\mkv\finished\
DEL /q e:\convert\mkv\subbing\*.*
GOTO CONVERT

VD
rem call start /wait d:\CONVERSION\BATCHFILES\DVD.BAT
GOTO CONVERT
:END