VideoHelp Forum
+ Reply to Thread
Results 1 to 1 of 1
Thread
  1. Hi cats,

    thanks to ndjamena I use this base-script to transcode some video files

    Code:
    @rem unless otherwise specified for debugging reasons turn echo off
    @if "%EMode%"=="" Set EMode=ON
    @ECHO %EMode%
    @ECHO off
    
    
    SetLocal DisableDelayedExpansion
    
    Set "EXTLIST=*.*"
    Set "DoPop=0"
    Set "ARGLVL=0"
    Set "FileName-DQ="
    Set VD_LOC="v:\automazioneclip\VirtualDub\vdub.exe"
    
    set "DestFolder=."
    Set "WorkFolder=%DestFolder%"
    
    rem process the arguments one by one
    :ARGS
    	
    	rem if there are no further arguments then exit the batch.
    	if [%1]==[] (
    		if "%ARGLVL%"=="0" (
    			CALL :GetTargetName		
    			EndLocal
    			pause
    		)
    		goto :eof
    	)
    
    	rem wildcard processing
    	Set "FileName=%~1"
    	if "%FileName%"=="" (
    		SHIFT
    		goto :ARGS
    	)
    
    	rem if the argument doesn't exist in the file system in any form skip it.
    	if NOT EXIST %1 (
    		SHIFT
    		goto :ARGS
    	)
    
    	if NOT [%1]==[] if NOT "%FileName:^*=%%FileName:^?=%"=="%FileName%%FileName%" (
    		for %%w in (%1) DO (
    			Set /a ARGLVL+=1
    			CALL :ARGS "%%~fw"
    			Set /a ARGLVL-=1
    		)
    		SHIFT
    		goto :ARGS
    	)
    	Set "FileName="
    		
    	rem Set search/recursion variables
    	Set "Pattern=%EXTLIST%"
    	Set "STARTLVL=0"
    	Set "FOUNDLVL=1024"
    	
    	rem if the argument is the current directory then process everything in it.
    	if "%~f1"=="%CD%" (
    		rem echo Processing Directory "%CD%"
    		CALL :START %1
    		SHIFT
    		goto :ARGS
    	)
    	rem Test if the argument is a directory, if it is move to it then process everything in it, if not then move to the file's parent directory and process the file.  Then return to starting directory.
    	Type NUL
    	pushd "%~f1" 2> nul
    	if NOT "%errorlevel%"=="0" (
    		if NOT "%CD%\"=="%~dp1" (
    			pushd "%~dp1"
    			Set "DoPop=1"
    		)
    		Set Pattern="%~nx1"
    	) else (
    		rem echo Processing Directory "%~f1"
    		Set "DoPop=1"
    	)
    	CALL :START %1
    	if "%DoPop%"=="1" (
    		popd
    		Set "DoPop=0"
    	)
    	SHIFT
    
    goto :ARGS
    
    :START <CURRENT_ARG>
    
    	rem Count is superseded by FOUNDLVL but may still be useful for renaming purposes
    	Set "Count=0"
    	rem Process all files in the current directory fitting the arguments search pattern.
    	for /f "delims=" %%y in ('dir %Pattern% /b /od /a-d') do (
    		if /I NOT "%%~y"=="File Not Found" CALL :Process_File "%%~fy"
    	)
    	rem if it didn't find anything search all directories instead
    goto :eof
    	if "%Count%"=="0" if %STARTLVL% LSS %FOUNDLVL% (
    		for /d %%b in (*) do (
    			pushd "%%~fb"
    			rem echo Processing Directory "%%~fb"
    			Set /a STARTLVL+=1
    			CALL :START "%%~fb"
    			Set /a STARTLVL-=1
    			popd
    		)
    	)
    
    goto :eof
    
    :Process_File <FILENAME>
    cls
    	Set /a Count+=1
    	Set "FOUNDLVL=%STARTLVL%"
    	SetLocal DisableDelayedExpansion
            if exist "%~dpn1.wav" (
            set "Audio=%~dpn1.wav"
            ) else (
            set "Audio=v:\automazioneclip\system\empty.wav")
            rem Find TimeCode Info
         	Set AUCount=0;
    	
            CALL :Make_File_generic "%WorkFolder%\%~n1.vcf" "%WorkFolder%\%~n1.avs" "%WorkFolder%\%~n1.avi" "%~f1"
    
    	echo  FATTO
    	echo.
    	echo ---------------------------------------------
    	echo.
    	EndLocal
    	
    goto :eof
    
    :Make_File_generic <VCF_FILENAME> <AVS_FILENAME> <FILENAME> <ORG_FILENAME>
    
    echo generic routine 
    
          xcopy c:\video\mycat.avi  ... .... .... ... bla bla bla
          
           goto :eof
    
    :GetTargetName
    
    	Set "FileName="
    	Set /p FileName=InputFileName:
    	
    	rem Add or remove double-quotes if necessary
    
    	if NOT DEFINED FileName (
    		Set "FileName-DQ="
    		goto :DQSkip
    	)
    	
    	Set "FileName-DQ=%FileName:"=%"
    	if NOT DEFINED FileName-DQ (
    		Set "FileName="
    Now I would like integrate a new function: when I start the script it should ask me

    "press the key 1 if you want lanczosresize or 2 for normal resize"
    1) LanczosResize
    2) normal resize


    if no-key pressend until 5 seconds ---> the script assume "normal resize"

    If 1) (lanczosresize) are pressed a enviroment variable --(become)--> "%lanczos%"=="1"
    If 2) (normalresize) are pressed a enviroment variable --(become)--> "%normal%"=="1"

    The script should ask to the user this message only 1 times, at the starting and using the same settings for all arguments without ask to the user the choice each time.

    How can I do? thanks
    Last edited by marcorocchini; 23rd Oct 2014 at 07:38.
    Quote Quote  
Visit our sponsor! Try DVDFab and backup Blu-rays!