rendered paste body; Theaterobers script, textbestand klaar maken voor import excel sheet
alias banden {
%fn = " $+ $sfile(d:\rj\theaterobers\*.txt) $+ "
; %fn = "C:\Documents and Settings\Robert-Jon\Desktop\mapje\bandenlijst.txt"
%fn2 = $left(%fn,-5) $+ _output.txt"
%lines = $lines(%fn)
%starting_time = $ctime
if ($exists(%fn2)) {
if ($input(Do you want to continue a previous conversion?,y)) {
%starting_line = $calc($lines(%fn2) + 1)
}
else {
%starting_line = 1
/write -c %fn2
}
}
else {
%starting_line = 1
}
%i = %starting_line
/echo -a 14Starting converting file " $+ $nopath(%fn) $+ " $+ $iif(%i != 1, from line %i) $+ . ( $+ %lines lines)
/.timer 1 0 /banden_process_line %i
}
alias banden_process_line {
%line = $read(%fn,%i)
if (%line == $null) {
/msg #realtezz 4DIKKE VETTE ERROR!!!
}
else {
if ($gettok(%line,1-2,32) == Directory of) {
%dir = $gettok(%line,3-,32)
/echo -a 14 $+ %dir
}
elseif (($right(%line,3) == wav) || ($right(%line,3) == mp3) || ($right(%line,3) == wma) || ($right(%line,3) == aac)) {
%file = $gettok(%line,5-,32)
/write %fn2 %dir $+ , %file
}
if ($calc(%i % $round($calc( %lines / 10 ) ,0) ) == 0) {
/echo -a 14Progress: $round($calc((%i / %lines) * 100),0) $+ % (Line %i of %lines $+ )
/echo -a 14Estimated finishing time: $asctime($calc( (%lines - %i) / (%i - %starting_line) * ($ctime - %starting_time) + $ctime),H:nn:ss)
}
inc %i
if (%i <= %lines) {
/.timer 1 0 /banden_process_line %i
}
else {
/echo -a 14Process complete. Created file $nopath(%fn2) with $lines(%fn2) lines.
/unset %fn %fn2 %i %line %dir %file %lines
}
}
}