Welcome Guest ( Log In | Register )


Important

The forums will be closing permanently the weekend of March 15th. Please see the notice in the announcements forum for details.

 
Script Expansion Suggestion "virtualdub.quit()", My code for that is inside
« Next Oldest | Next Newest » Track this topic | Email this topic | Print this topic
Zapunidy
Posted: Jan 5 2011, 07:53 PM


Newbie


Group: Members
Posts: 3
Member No.: 29538
Joined: 5-January 11



Quite recently I made batch video recoding with VirtualDub and had found no better way as to
1) Write a VirtualDub script for a single file with its name given as a command line parameter.
2) Writing a windows batch script for providing all avi files one by one to VirtualDub.
The problem that I encountered is that I couldn't automatically terminate VirtualDub, other than tskill its process after a certain delay. And I need to terminate it as every new conversion leaves VirtualDub window after its completion. That is why I suggest adding VirtualDub.Quit() instruction to Sylia.
I downloaded source code of VirtualDub 1.9.11 and added the following lines to the VirtualDub\source\Script.cpp file:
After line 1920
CODE
static void func_VirtualDub_Quit(IVDScriptInterpreter *, VDScriptValue *arglist, int arg_count) {
g_project->Quit();
}

After line 1963
CODE
{ func_VirtualDub_Quit,    "Quit",     "0" },

That's all. Works like magic now. Would you add this to the official branch, phaeron?
 
     Top
dloneranger
Posted: Jan 5 2011, 08:02 PM


Moderator


Group: Moderators
Posts: 2366
Member No.: 22158
Joined: 26-September 07



Command line option /x already quits on completion

vdub /? will show the rest, or you could read the help file->advanced operation->command-line operation

For parameters, the /i options lets you use it like this

Batchfile
CODE

:loop
if %1.==. goto theend
VDub.exe /i "d:\somescript.vdf" "%~1" "P:\NewVideos\%~nx1" /x
if not %errorlevel% == 0  goto err
shift
goto loop
:err
echo Error %errorlevel% with %~nx1
pause
goto theend
:theend
pause

Script
CODE
VirtualDub.Open( VirtualDub.params[0] ,"",0);
..... some script functions ........
VirtualDub.SaveAVI(VirtualDub.params[1]);


That'll give you a batch file that applies 'somescript' to all the files dropped onto the .bat file, with the destination avi going to the directory P:\NewVideos\ (with the same filename)


--------------------
MultiAdjust JoinWav WavNormalize FFMPeg Input Plugin v1827 UnSharpMask
Windows7/8 Codec Chooser
All FccHandlers Stuff inc. Installers for acm codecs AAC, AC3, LameMp3
 
    Top
Zapunidy
Posted: Jan 7 2011, 09:31 PM


Newbie


Group: Members
Posts: 3
Member No.: 29538
Joined: 5-January 11



Thanks for the info. Indeed, the /x command line option fully satisfies the goal, but isn't it natural to have a script command also? I've spent a while inventing workarounds, never considering /x option. There could be others like me who would appreciate script command by the cost of ~15 more compressed program code bytes.
 
     Top
dloneranger
Posted: Jan 7 2011, 09:54 PM


Moderator


Group: Moderators
Posts: 2366
Member No.: 22158
Joined: 26-September 07



You'd have to be careful about handling a quit script command as
1) you can load saved configurations - > oops virtualdub closed
2) job queues->oops again when 1 job finishes
3) reloading a queued job
4) you can start virtualdub with /s and load a script on startup ->oops again+looks like virtualdub never opens

--------------------
MultiAdjust JoinWav WavNormalize FFMPeg Input Plugin v1827 UnSharpMask
Windows7/8 Codec Chooser
All FccHandlers Stuff inc. Installers for acm codecs AAC, AC3, LameMp3
 
    Top
phaeron
Posted: Jan 12 2011, 04:12 AM


Virtualdub Developer


Group: Administrator
Posts: 7773
Member No.: 61
Joined: 30-July 02



I must be missing something, but doesn't VirtualDub.Exit(0) do the trick?
 
    Top
Zapunidy
Posted: Jan 12 2011, 08:26 AM


Newbie


Group: Members
Posts: 3
Member No.: 29538
Joined: 5-January 11



Well, I used this script manual http://www.virtualdub.org/docs/vdscript.txt. No "Exit" function is defined there. Since that document is rather old, I tried to guess an exit function with ".Exit()" and ".Quit()" with no success. ".Exit(0)" works fine indeed.
Am I missing newer script manual posted somewhere?
 
     Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
5 replies since Jan 5 2011, 07:53 PM Track this topic | Email this topic | Print this topic

<< Back to VirtualDub Development Forum