CallCmd
From Avisynth wiki
Abstract | |
---|---|
Author | StainlessS |
Version | v1.04 |
Download | CallCmd_x86_x64_dll_v1.04_20180404.zip |
Category | Support filters |
License | GPLv2 |
Discussion | Doom9 Forum |
Contents |
Description
Plugin to execute command on selectable frames or at startup or closedown.
Based on Call by Nic:- http://forum.doom9.org/showthread.php?t=46506
Requirements
- [x86]: AviSynth+ or AviSynth 2.6
- [x64]: AviSynth+
- *** vcredist_x86.exe is required for CallCmd-x86
- *** vcredist_x64.exe is required for CallCmd-x64
Syntax and Parameters
CallCmd(clip,string "Command"="", string "Frames"="",string "Insert"="",int "Digits"=6,bool "Once"=true,int "Offset"=0, bool "Hide"=false,bool "Debug"=false,string "Open"="",string "Close"="",int "Synchronous"=7) Command (default"") A command string that will be executed on each frame specified by the Frames arg. Can contain a single INSERT arg character which will be replaced by a string representing the frame number with optional OFFSET. If the command naturally contains the INSERT character then choose a different INSERT charcter or use two INSERT characters in the Command string to escape it (one of them will be removed in the executed command). Frames (default "") String to specify the frames upon which the COMMAND arg is executed. Comments beginning with '#' can occur in the FRAMES arg, SEMICOLON Cannot be used in a comment. SEMICOLON ";" or NewLine [Chr(10)] is used as a frame specifier terminator. COMMA "," specifies a frame range where the 2nd range end number can be '0' meaning last frame, and eg '-4' meaning 4 frames. "0,0" Specifies ALL frames. Example: FRAMES=" 1 # This is a comment, calls on frame 1. 3;5;7 # Calls on frames 3 and 5 and 7, SEMICOLON is SOFT End Of Line and terminates any COMMENT. 8 # Call Frame 8 ; 10 # *** IMPORTANT *** And because of SEMICOLON also calls on Frame 10. 14,16 # Calls on frames 14 to 16, COMMA specifies a frame range. 18,20;22 # Calls on Frame range 18 to 20 and frame 22. 24,-4 # Specifies frames 24 to 27, ie 4 frames starting at frame 24. " Insert (default "") Single character which will be replaced in the Command arg string by frame number + OFFSET arg. If the command naturally contains an INSERT character then choose a different INSERT arg charcter or use two INSERT characters in the Command string to escape the naturally occuring one (one of them will be removed in the executed command). Digits (default 6) Minimum number of digits generated in inserted text that replaces the INSERT character in the COMMAND arg. Once (default=true) If true then only executes frame commands once on each frame, if replayed, does not exec 2nd time. Offset (default 0) Offset added to frame number when generating text inserted into a frame command replacing the INSERT character. Hide (default false) If true, hide black console window on command execution. Debug (default false) If true, sends debug info to DebugView Window. DebugView (Highly recommended, allows viewing of info and warnings from the plugins and other programs) http://technet.microsoft.com/en-gb/sysinternals/bb545027 Open (default "") Command executed on plugin start up (Constructor), before first frame. No string replacements, ie INSERT, DIGITS and OFFSET have no effect. Close (default "") Command executed on plugin close down (Destructor), after last frame. No string replacements, ie INSERT, DIGITS and OFFSET have no effect. Synchronous (default 7, range 0 - 7) The Synchronous arg is a group of 3 bitflags, bit 0 if set means wait for process to terminate before returning from the 'Open' command. bit 1 if set means wait for process to terminate before returning from the 'Frames' commands. bit 2 if set means wait for process to terminate before returning from the 'Close' command. 0 = All Asynchronous, ie dont wait at all. 1 = Wait only on 'Open' command. 2 = Wait only on 'Frames' commands. 3 = Wait on 'Open' and 'Frames' commands. 4 = Wait on 'Close' command. 5 = Wait on 'Open' and 'Close' commands. 6 = Wait on 'Frames' and 'Close' commands. 7 = Wait on ALL commands (default). Beware, if you dont wait it is very possible that any future reliance upon output of command may fail due to the output file being in use. Also, if debug true and waiting for process to complete, then will also show the process return code on successful process creation (and completion) in DebugView, cannot do this if NOT waiting completion. ----------------------------------------------------------------------------- CallCmd, does NOT replace single quotes with double quotes in Command string, was source of problems in Call(). Instead wrap eg filenames containing spaces in double-quotes using perhaps: Function QuoteStr(String s) { return Chr(34) + s + Chr(34) } or use triple and single double-quotes eg CallCmd(BlankClip,Close="""d:\nicecho.exe @d:\report.txt "Appending" """) --- Executing on each playing, on every frame, hiding console window, sending debug info to debugview, and converting command string on frame eg 0 to "C:\PortableApps\ImageMagick\Mogrify.exe -flop C:\Temp\000000.tif" CallCmd(clip,"C:\PortableApps\ImageMagick\Mogrify.exe -flop C:\Temp\#.tif", "0,0",Insert="#",Once=false,Hide=true,Debug=true) At Open, executes delete on wildcard files silently, without asking confirmation. CallCmd(Open="""cmd /c DEL /Q "C:\TEMP\test_*.tif" """) To execute DOS type commands, in DOS console type "cmd /?" for cmd options, and eg DEL /? for delete options.
Examples
Changelog
v0.00b beta - 27 Sept 2012, first Release v0.01b beta - 01 Oct 2012 v1.00, - 08 Oct 2012, Changed Frames spec, added Open,Close v1.01, - 21 Oct 2012, Add Synchronous Arg. v1.02, - 1 Jan 2013, Add error message on fail. v1.03, SetLastError(ERROR_SUCCESS) prior to call. v1.04, - 3 Apr 2018, compile VS2008
Archived Downloads
Version | Download | Mirror |
---|---|---|
v1.04 | CallCmd_x86_x64_dll_v1.04_20180404.zip | CallCmd_x86_x64_dll_v1.04_20180404.zip |
External Links
Back to External Filters ←