Log in

View Full Version : CallCmd v1.04 - x86 & x64 -Execute command


Pages : [1] 2

StainlessS
8th October 2012, 23:34
Plugin to execute command on selectable frames or at startup or closedown.


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 (+x64)



CallCmd() by StainlessS:- http://forum.doom9.org/showthread.php?t=166063

Based on Call by Nic:- http://forum.doom9.org/showthread.php?t=46506

--------------------------------------------------------------------------------
CallCmd() by StainlessS

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.

ssS


Zip included Avsiynth v2.58, avs+ v2.6 x86, and Avs+ x64 dll's, + source (~75 KB).
req VS 2008 runtimes.

Available from MediaFire or SendSpace in Sig.

StainlessS
9th October 2012, 01:27
Posted here by Martin53:
http://forum.doom9.org/showthread.php?p=1594690#post1594690


CMD= "cmd/c del " + QuoteStr(TMPDIR + BASENAME + RD_NSTR + EXT) +
\ " && ren "+ QuoteStr(TMPDIR + BASENAME + INSERT + EXT) + " " + QuoteStr(TMPDIR + BASENAME + RD_NSTR + EXT) +
\" && " + QuoteStr(IM) + IMCMD + QuoteStr(TMPDIR + BASENAME + RD_NSTR + EXT)
#RD_NSTR = "%0"+String(DIGITS)+"d"
RD_NSTR = "000000"


How about this.


ColorBars().ShowFrameNumber().ConvertToRGB24().Trim(0,499)
IM="C:\PortableApps\ImageMagick\Mogrify.exe" # ImageMagick Mogrify exe
TMPDIR="C:\Temp\" # Output directory for images
IMCMD =" -flop " # Image Magick Mogrify Command, Horizontal Flip (Or whatever).
TYPE ="tif" # Extension type
CMDFILESPEC=QuoteStr(TMPDIR + "#" + "." + TYPE)
CMD= QuoteStr(IM) + IMCMD + CMDFILESPEC
DEL= "cmd /c del /Q " + CMDFILESPEC
W=Width # Remember orig width
#
ImageWriter(TMPDIR,0,-1, type=TYPE).RT_AverageLuma(n=0,w=1,h=1) # Force 1st image else error in ImageReader
# --------------------------------
ImageWriter(TMPDIR,0,0, type=TYPE)
CallCmd(CMD,"0,0",insert="#",once=false,hide=true)
StackHorizontal(ImageSource(TMPDIR+"%06d."+TYPE,0,FrameCount-1))
Crop(W,0,-0,-0) # Comment out to show input and h-flipped output side by side
CallCmd(DEL,"0,0",insert="#",once=false,hide=true)
Return Last
# --------------------------------
Function QuoteStr(String s){Chr(34) + s + Chr(34)}


Works OK, deletes every frame after use and just before frame delivered to eg VDUB, no scriptclip.
Tried going backwards and jumping about, seems to still work without problems and no images left in TMPDIR.
If you set up a RAMDISK for temp files/file (and perhaps imagemagick), it might fly like a bat out of hell, then again it might not.
RAMDISK.SYS or similar, http://en.wikipedia.org/wiki/List_of_RAM_drive_software).
Would be interested in hearing if it made much (if any) difference.

EDIT: Actually, the DEL command seems to take quite a bit of time to execute, perhaps CMD.exe would need to be on ramdisk too,
or a better, a lightweight DEL type command obtained. It's disappointingly slow compared to the figures you gave for scriptclip
version, dont know why yet.

EDIT: See RT_Stats RT_FileDelete().

martin53
20th October 2012, 17:55
StainlessS,
hope you don't mind that I respond so late. I'm very much involved in my daytime job and the frame substitution filter. Same will apply in the future, i'm afraid.

Does C++ offer a "wait for return" switch for a shell call? With Visual Basic Script shell calls, I know such a switch.
I never mentioned it before, because all Calls I could imagine would not reasonably continue before the shell command was executed. But it's a different thing with the DEL command. That could well be finished asynchronously.

StainlessS
21st October 2012, 17:56
CallCmd waits for the process to both start and end (as Call did), I guess I could add an arg to return immediately,
It might well be the CMD.Exe that is slow to start though, I know it checks eg AutoRun type entries
in the registry and probably an amount of other startup stuff. (CMD /D disables AutoRun).
I'll add the arg soon.


EDIT: RAMDISK dont seem to be beneficial, guess that the ScriptClip single tif version is hitting the disk cache
all of the time and therefore gives better performance.

jmac698
21st October 2012, 21:41
What would be really cool is to call an external program on frames and be able to return an image. There are some pretty cool filters (research) that you could call that only work on one frame. Usually they only support one frame or simple bmps. There are a lot of extra steps to make them process video. Being able to simply embed a command line to serve frames to external image processing would be amazingly easier.

I think it's quite easy to code; just read out the current frame in a loop and write it as a temp file as a BMP (the format is quite simple to do), call the command, the command does "process -i in.bmp out.bmp" and have the program wait, then read out.bmp and return that to Avisynth. If you have everything setup for development, it's just a few more lines of code; except writing the .bmp part, but I've done that by hand, you can copy the header from any existing file and just change the width and height and file length values. All I remember is it starts with BM :)

One more feature, I might need at least 3 passes so next version have option to send each plane as separate calls (either r,g,b or y,u,v)

Oh you know how nice that would be.. instead of fiddling with command lines and loading the results in an image viewer, it can all be done in AvsP with instant preview, all it's features for script editing, user sliders! It's like istant gui for cmd line.

StainlessS
21st October 2012, 21:41
CallCmd() v1.01, New version, added 'Synchronous' arg.

@Jmac, oops you just clipped me.
Think that the suggested plug would be another filter.

a command line to serve frames to external image processing would be3 amazingly easier

I look forward to it with baited breath. :)

EDIT: I dont really see it as being any great improvement over using ImageWrite/CallCmd/ImageRead combo, just
a lot more work for YOU. ;)

jmac698
21st October 2012, 22:00
Oops, someone had that idea... what's this "ScriptClip single tif version"

StainlessS
21st October 2012, 22:12
http://forum.doom9.org/showthread.php?p=1594454#post1594454

Also, dont know if you did eventually find the Showchannels update (as requested).
Page 2 of Usage section.

EDIT:
@Martin53,
trust you saw the MDepan stuff in RT_Stats (last post), together with the StrReplace problem that you would encounter
(fixed here: http://forum.doom9.org/showthread.php?p=1596053#post1596053)

StainlessS
1st January 2013, 22:11
New version v1.02, Appends system error message on fail when debug=true (debugview).
See first post.

StainlessS
13th November 2013, 18:31
Can any DOS wizard assist here ?

What I want to do is execute a line like this


C:\WINDOWS\system32\cmd.exe /K "C:\BIN\ffprobe.exe -i D:\AVS\AVI\TEST.VOB"


Where

"C:\WINDOWS\system32\cmd.exe" is the DOS CLI

/K means keep console window open on completion (will eventually use /C ie close on completion)

"C:\BIN\ffprobe.exe -i D:\AVS\AVI\TEST.VOB" is command to be executed by the DOS CLI together with args for target executable.

What I want is to redirect output from ffprobe (written to DOS CLI console window via stderr or stdout) to a file,
is there a way to redirect output from a NON DOS command (DOS COMMAND being eg DIR) where the NON DOS
command does not provide a way to accomplish same thing.

thanks in advance :)

martin53
13th November 2013, 18:45
I don't own ffprobe.exe . But generally the job split is like this:
- All executables should write to the streams stdout, stderr etc., i.e. this is not restricted to cmd.exe-internal commands.
- Cmd.exe allows to redirect or pipe stdout to a file with the '>' operator overwriting or '>>' appending.

There is a Syntax '2>' to redirect "stream 2" stderr: Try 'NonexistentCommand 2>test' at the command line. The file 'test' will contain cmd.exe's error message.

You sure tried
'C:\WINDOWS\system32\cmd.exe /K "C:\BIN\ffprobe.exe -i D:\AVS\AVI\TEST.VOB" >Path\File'. What did happen instead of the expected behaviour?

EDIT: Many old compiler packs contained a program TEE.EXE. You pipe any program's output to TEE and give TEE a file name. TEE mirrors its input to both stdout and the file.

Groucho2004
13th November 2013, 18:48
Can any DOS wizard assist here ?

What I want to do is execute a line like this


C:\WINDOWS\system32\cmd.exe /K "C:\BIN\ffprobe.exe -i D:\AVS\AVI\TEST.VOB"


Where

"C:\WINDOWS\system32\cmd.exe" is the DOS CLI

/K means keep console window open on completion (will eventually use /C ie close on completion)

"C:\BIN\ffprobe.exe -i D:\AVS\AVI\TEST.VOB" is command to be executed by the DOS CLI together with args for target executable.

What I want is to redirect output from ffprobe (written to DOS CLI console window via stderr or stdout) to a file,
is there a way to redirect output from a NON DOS command (DOS COMMAND being eg DIR) where the NON DOS
command does not provide a way to accomplish same thing.

thanks in advance :)

Use this:

C:\WINDOWS\system32\cmd.exe /K "C:\BIN\ffprobe.exe -i D:\AVS\AVI\TEST.VOB 2> file.txt"


P.S. Please don't refer to the NT CLI as "DOS". :rolleyes:

martin53
13th November 2013, 18:55
Cmd.exe does not expect everything after /C or /K to be one quoted string.
C:\WINDOWS\system32\cmd.exe /K C:\BIN\ffprobe.exe -i D:\AVS\AVI\TEST.VOB 2> file.txt
should work as well, and also
C:\WINDOWS\system32\cmd.exe /K C:\BIN\ffprobe.exe -i "D:\AVS\AVI path with spaces\TEST.VOB" 2> "D:\Output path with spaces\file name with spaces.txt"

StainlessS
13th November 2013, 18:55
Dang but you are correct.
Had already tried same but failed, musta screwed up somewhere and thought it down to cmd.exe needing executable string at END of line
(according to "CMD /?").

Thank you.

EDIT:

P.S. Please don't refer to the NT CLI as "DOS". :rolleyes:

I consider my bottom, justly smacked :)

Groucho2004
13th November 2013, 18:58
Cmd.exe does not expect everything after /C or /K to be one quoted string.
Typo, sorry. I'm sure Stainless figures it out.

StainlessS
13th November 2013, 20:02
I don't own ffprobe.exe

ffprobe.exe is part of ffmpeg, although may not always come with all packages.

Using string to CallCmd (EDIT: well actually RT_Call, but almost same thing)

C:\WINDOWS\system32\cmd.exe /K "C:\BIN\ffprobe.exe" -i D:\AVS\AVI\TEST.VOB 2> D:\AVS\AVI\TEST.TXT


obtains this in TEST.TXT


ffprobe version N-44264-g070b0e1 Copyright (c) 2007-2012 the FFmpeg developers
built on Sep 7 2012 17:35:17 with gcc 4.7.1 (GCC)
configuration: --enable-gpl --enable-version3 --disable-pthreads --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-
frei0r --enable-libass --enable-libcelt --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm
--enable-libmp3lame --enable-libnut --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora
--enable-libutvideo --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs
--enable-libxvid --enable-zlib
libavutil 51. 72.100 / 51. 72.100
libavcodec 54. 55.100 / 54. 55.100
libavformat 54. 25.105 / 54. 25.105
libavdevice 54. 2.100 / 54. 2.100
libavfilter 3. 16.100 / 3. 16.100
libswscale 2. 1.101 / 2. 1.101
libswresample 0. 15.100 / 0. 15.100
libpostproc 52. 0.100 / 52. 0.100
[mpeg @ 0231c500] max_analyze_duration 5000000 reached at 5024000
Input #0, mpeg, from 'D:\AVS\AVI\TEST.VOB ':
Duration: 00:08:49.63, start: 499.807267, bitrate: 5068 kb/s
Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p, 720x576 [SAR 64:45 DAR 16:9], 7500 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
Stream #0:1[0x80]: Audio: ac3, 48000 Hz, 5.1(side), s16, 384 kb/s
Stream #0:2[0x81]: Audio: ac3, 48000 Hz, stereo, s16, 192 kb/s


EDIT: This seems best solution for in/out paths containing SPACE characters:

C:\WINDOWS\system32\cmd.exe /K C:\BIN\ffprobe.exe -i "D:\A V S\AVI\TEST.VOB" 2>"D:\A V S\AVI\TEST.TXT"


Quotes around both input and output files but not about ffprobe.exe, if ffprobe.exe path changed to "D:\A V S\AVI\"
then fails, could not find any combination of single/triple quotes that worked for all three paths.

EDITED:
One of the problems is that, enclosed in quotes, ffprobe complains about it's own file name being supplied as an arg to ffprobe,
perhaps it is only an ffprobe problem, and not a general prob.

martin53
1st December 2013, 15:54
Just updated to V1.02 as you proposed, but now cannot open my clip any more:
I just need CallCmd in destructor.
But V1.02 complains about the empty frames string and refuses to go on. Btw the V1.02 plugin has name 1.01 on mediafire - or I'm struggling with 1.01 and 1.02 was not published.

M53

EDIT: not true. The new version complained about the other calls that were not yet corrected to the new syntax, but still read "-3" as frame identifier, instead of using the new 'Close=' parameter.

StainlessS
1st December 2013, 19:09
Sorry, yes v1.01 should have read v1.02, just forgot to rename the containing folder before zipping, shall re-upload now using correct name.



The new version complained about the other calls that were not yet corrected to the new syntax, but still read "-3" as frame identifier, instead of using the new 'Close=' parameter.

Dont know what you mean by that,

something like this

colorbars
CallCmd(command="CMD DIR C:\",frames="-3",debug=true)

Produces this debug output, last line being error message clip returned

00000001 0.00000000 CallCmd: Constructor IN
00000002 0.00001575 CallCmd: CallCmd: v1.02 - 01 Jan 2012 - by StainlessS
00000003 0.00004092 CallCmd: Command for Frames = 'CMD DIR C:\'
00000004 0.00016734 CallCmd: FRAMES: About to Parse Frames String
00000005 0.00019256 CallCmd: FRAMES: Line 1:1 *NON PARSE* $-3 @ -3



This being more like call on close

colorbars
CallCmd(close="""CMD /C "DIR C:\" """,debug=true)


producing

00000001 0.00000000 CallCmd: Constructor IN
00000002 0.00001629 CallCmd: CallCmd: v1.02 - 01 Jan 2012 - by StainlessS
00000003 0.00004046 CallCmd: Command for Frames = ''
00000004 0.00006518 CallCmd: Close Command (Destructor) = 'CMD /C "DIR C:\" '
00000005 0.00018594 CallCmd: FRAMES: About to Parse Frames String
00000006 0.00021042 CallCmd: Doing command on 0 Frames
00000007 0.00023386 CallCmd: Constructor OUT
00000008 2.17909861 CallCmd: Destructor IN
00000009 2.17913342 CallCmd: Close (Destructor) on command 'CMD /C "DIR C:\" '
00000010 2.23332262 CallCmd: SUCCESS Creating Process (WAIT)
00000011 2.23336267 CallCmd: WAIT, Process returned 0 (0x00000000)
00000012 2.23341632 CallCmd: Destructor OUT


What script are you trying ?

EDITED:

EDIT: OOPS, now I understand, you mean your script still used old frames spec of -3, thought you meant that
the new version still worked with old spec, silly me.

martin53
2nd December 2013, 18:35
StainlessS,
I got everything running :). I was trying to say that I used 3 calls, and only had converted one to the "close=" syntax. Therefore, the first of the other two remaining script lines produced the output you wrote: "...*NON PARSE* $-3 @ -3" - and I misunderstood this as an error message of the line I had already changed. After I also changed the other two lines, it was fine!

vampiredom
5th December 2013, 23:40
I simply MUST try this ... I would love to get rid of my crazy Call25Helper.exe hack. Unfortunately, I have been really short on time to test out new things. I will try this out and get back to you. Thanks, Stainless.

StainlessS
6th December 2013, 02:11
Vampiredom, There is also a compile/run time version in RT_Stats, not based on Frame number, Constructor, Destructor.

vampiredom
14th December 2013, 00:25
I finally got around to trying it, StainlessS. It works a treat. Excellent. I have no idea if this is even possible… but it there some way to have a function like this return a program's STDOUT to AviSynth as a string? That would be extremely useful.

martin53
15th December 2013, 21:10
return a program's STDOUT to AviSynth as a string?
What you can do today is redirect STDOUT to a file, and read the file from AviSynth. See here (http://forum.doom9.org/showthread.php?p=1653164#post1653164)

vampiredom
16th December 2013, 02:03
What you can do today is redirect STDOUT to a file, and read the file from AviSynth. See here (http://forum.doom9.org/showthread.php?p=1653164#post1653164)

Thanks. Yeah, I already do stuff like this ... I often write Perl scripts and such that generate strings and write them out as AviSynth variables in a text file, Import() them in AviSynth, etc.

It would just be handy (and cleaner) to have AviSynth be able to read the STDOUT directly, I suppose. :)

StainlessS
10th November 2015, 16:29
Been playing a little with functions to extract MediaInfo using CallCmd

Library of funcs, require CallCmd, RT_Stats, GScript. [EDIT: And of course the magnificent MediaInfo.exe, CLI version]

# CallCmd_MediaInfo.Avs
#
# If Below Global Variable Exists then will use it, Otherwise MediaInfo.Exe must live somewhere in Path of system Environment.
#Global MEDIAINFO_PATH = "C:\BIN\MediaInfo.Exe" # Modify for your system, Can Comment out if MediaInfo.Exe already in system Path.

######
# Debug sends ONLY CallCmd output to DebugView
######
Function CallCmdReturnOutput(String "Cmd",Bool "Debug") {
# Call with temporary output filename placement insertion position flagged with '@@@FILENAME@@@' (excluding quotes).
# Returns with output filename in string, or Int(-1) on error.
myName="CallCmdReturnOutput: " Debug=Default(Debug,False)
Find_FN_S="@@@FILENAME@@@" pos = RT_FindStr(Cmd,Find_FN_S,Sig=False)
Assert(pos!=0,RT_String("%sOutput Filename not flagged in CMD arg string\n'%s'",myName,Cmd))
fn=RT_GetFullPathName("MediaInfo_"+RT_LocalTimeString(File=true)+".txt") # Unique filename, full path
Cmd=RT_StrReplace(Cmd,Find_FN_S,fn)
RT_FileDelete(fn) # Delete output file prior to Call (Unlikely to ever Exist)
CallCmd(BlankClip(Length=1), Open=Cmd, Hide=true, debug=Debug, Synchronous=1) # Call the command, wait command terminated.
return (Exist(fn)) ? fn : -1
}

######
# Debug sends CallCmd Info + COMPLETE MediaInfo output to DebugView
######
Function GetMediaInfo(String VidFn,Bool "Debug",Bool "DelOutputFile") {
# Get MediaInfo
myName="GetMediaInfo: " DelOutputFile=Default(DelOutputFile,True) Debug=Default(Debug,FalsE)
VidFn=RT_GetFullPathName(VidFn)
# If Global Var exists, then use it else expect MediaInfo to be in a system path.
MEDIAINFO = RT_VarExist("MEDIAINFO_PATH") ? MEDIAINFO_PATH : "MediaInfo.Exe"
# Below, Double %% is ESCaped representation of single %, ie must use %% for literal single %, % is insertion marker for RT_String.
Fmt="""%s --LogFile="@@@FILENAME@@@" --Inform=Video; "%s" """
# Below inserts MEDIAINFO at beginning and VidFn at end of string
Cmd=RT_String(Fmt,MEDIAINFO,VidFn)
Ofn=CallCmdReturnOutput(Cmd,Debug=Debug)
Assert(Ofn.IsString,RT_string("%sCallCmdReturnOutput return FAILED",myName))
Txt=RT_ReadTxtFromFile(Ofn)
(Debug) ? RT_DebugF("MediaInfo:\n%s",Txt,name=myName) : NOP
(DelOutputFile) ? RT_FileDelete(Ofn) : NOP
return Txt
}

######
# Debug sends ONLY FULL SECTION Info to DebugView
######
Function ExtractMediaInfoSection(String Txt,String SectionName,Bool "Debug") {
myName="ExtractMediaInfoSection: " Debug=Default(Debug,False) Lines=RT_TxtQueryLines(Txt) T="" InSect= False
GSCript("""
For(i=0,Lines-1){S=RT_TxtGetLine(Txt,i)if(S==SectionName){InSect=True}else if(S==""){InSect=False} else if(InSect){T=RT_TxtAddStr(T,S)} }
""")
(Debug) ? RT_DebugF("%s:\n%s",SectionName,T,name=myName) : NOP
Return T
}

Function GetMediaInfoSection(String VidFn,String "SectionName",Bool "Debug") {
# Get MediaInfo by SectionName (Default="Video") and return as String. Section Name eg "General", "Video", "Audio", "Audio #1", "Text #3"
# Will return "" if SectionName does not exist (eg "Text #24" does not exist, or "Audio #1" when only "Audio" section in file).
SectionName=Default(SectionName,"Video")
Txt=GetMediaInfo(VidFn)
return ExtractMediaInfoSection(Txt,SectionName,Debug)
}

Function GetGeneralInfo(String VidFn,Int "Stream",Bool "Debug") {
Stream = Default(Stream,0) # Default is NO STREAM Number (Unlikely more than 1 General section)
SectionName=(Stream==0)?"General":"General #"+String(Stream)
Return GetMediaInfoSection(VidFn,SectionName,Debug=Debug)
}

Function GetVideoInfo(String VidFn,Int "Stream",Bool "Debug") {
Stream = Default(Stream,0) # Default is NO STREAM Number
SectionName=(Stream==0)?"Video":"Video #"+String(Stream)
Return GetMediaInfoSection(VidFn,SectionName,Debug=Debug)
}

Function GetAudioInfo(String VidFn,Int "Stream",Bool "Debug") {
Stream = Default(Stream,0) # Default is NO STREAM Number
SectionName=(Stream==0)?"Audio":"Audio #"+String(Stream)
Return GetMediaInfoSection(VidFn,SectionName,Debug=Debug)
}

Function GetTextInfo(String VidFn,Int "Stream",Bool "Debug") {
Stream = Default(Stream,0) # Default is NO STREAM Number
SectionName=(Stream==0)?"Text":"Text #"+String(Stream)
Return GetMediaInfoSection(VidFn,SectionName,Debug=Debug)
}

Function GetFirstStream(String VidFn,String SectionName,Bool "Debug") {
S=GetMediaInfoSection(VidFn,SectionName,Debug=Debug)
S=(S=="")?GetMediaInfoSection(VidFn,SectionName+" #1",Debug=Debug):S
return S
}

######
# Debug shows only Specific Info.
######

Function ExtractSpecificMediaInfo(String SectionText,String IDString,bool "Debug") {
myName="ExtractSpecificMediaInfo: "
Debug=Default(Debug,false)
Ret = "" # Not Found
Lines=RT_TxtQueryLines(SectionText)
GSCript("""
For(i=0,Lines-1) {
S=RT_TxtGetLine(SectionText,i)
if(RT_FindStr(S,IDString,sig=False)==1) {
S=MidStr(S,Strlen(IDString)+1) # Strip IDString from Start
While(RT_Ord(S)==32 || RT_Ord(S)==9) {S=MidStr(S,2)} # Eat White
if(LeftStr(S,1)==":") {
S=MidStr(S,2) # Strip Colon
While(RT_Ord(S)==32 || RT_Ord(S)==9) {S=MidStr(S,2)} # Eat White
Ret = S # Result
i = Lines # Break
}
}
}
""")
(Debug) ? RT_DebugF("'%s' = '%s'",IDString,S,name=myName) : NOP # Write IDString = Extracted Text to DebugView
return Ret
}

Function FirstStreamSpecificMediaInfo(String VidFn,String SectionName,String IDString,Bool "Debug") {
S=GetFirstStream(VidFn,SectionName)
return ExtractSpecificMediaInfo(S,IDString,Debug=Debug) # Debug Output ONLY eg "Display aspect ratio = 16:9"
}

Function GetAspectRatio(String VidFn,Int "Stream",Bool "Debug") {
# Demo individual purpose function
Stream = Default(Stream,0) # Default is NO STREAM Number
S=GetVideoInfo(VidFn,Stream)
return ExtractSpecificMediaInfo(S,"Display aspect ratio",Debug=Debug) # Debug Output ONLY eg "Display aspect ratio = 16:9"
}

EDITED:

And demo Client

# CallCmd_MediaInfo_Client.Avs

Import("CallCmd_MediaInfo.Avs")

Colorbars.KillAudio

#NAME="Out.AVI" # No Stream numbers usually eg "Audio", not "Audio #1"
NAME="VTS_01_1.VOB" # Possible Stream Numbers eg "Text #1"

STREAM = 0
DEBUG = True

################################################
# UNCOMMENT ONE OF BELOW and Set Above STREAM #
################################################

###
# Send CallCmd + Complete MediaInfo to DebugView
###
#S=GetMediaInfo(NAME,Debug=DEBUG)

###
# Send Section INFO to DebugView
###
#S=GetVideoInfo(NAME,Stream=STREAM,Debug=DEBUG)
#S=GetAudioInfo(NAME,Stream=STREAM,Debug=DEBUG)
#S=GetTextInfo(NAME,Stream=STREAM,Debug=DEBUG)
#S=GetFirstStream(NAME,"Audio",Debug=DEBUG)
#S=GetFirstStream(NAME,"Text",Debug=DEBUG)


###
# Send ONLY Specific INFO to DebugView
###
#S=GetAspectRatio(NAME,Stream=STREAM,Debug=DEBUG)
#S=GetVideoInfo(NAME).ExtractSpecificMediaInfo("Display aspect ratio",Debug=DEBUG)
#S=FirstStreamSpecificMediaInfo(NAME,"Audio","Format",Debug=DEBUG)

###
# Leave MediaInfo generated file in current directory, Looks something like "MediaInfo_20151110_225534_968.txt"
###
S=GetMediaInfo(NAME,Debug=DEBUG,DelOutputFile=False)

############################
############################
############################

S = (S!="") ? RT_StrReplace(S,Chr(10),"\n") : S
Return SubTitle(String(S),lsp=0,Font="Courier New")


Oops, got my Channels and Streams muxed up, Demuxed.

StainlessS
10th November 2015, 16:40
Further to previous post, here MediaInfo output of typical VOB with stuff that can be extracted.
EDIT: Sections are separated by Blank Line, with section Name at start of each section.


General
Complete name : D:\CallCmd\VTS_01_1.VOB
Format : MPEG-PS
File size : 1 024 MiB
Duration : 24mn 48s
Overall bit rate mode : Variable
Overall bit rate : 5 770 Kbps

Video
ID : 224 (0xE0)
Format : MPEG Video
Format version : Version 2
Format profile : Main@Main
Format settings, BVOP : Yes
Format settings, Matrix : Custom
Duration : 24mn 48s
Bit rate mode : Variable
Bit rate : 4 695 Kbps
Maximum bit rate : 8 436 Kbps
Width : 720 pixels
Height : 576 pixels
Display aspect ratio : 16:9
Frame rate : 25.000 fps
Standard : PAL
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Interlaced
Scan order : Top Field First
Compression mode : Lossy
Bits/(Pixel*Frame) : 0.453
Stream size : 833 MiB (81%)

Audio #1
ID : 189 (0xBD)-128 (0x80)
Format : AC-3
Format/Info : Audio Coding 3
Mode extension : CM (complete main)
Format settings, Endianness : Big
Muxing mode : DVD-Video
Duration : 24mn 48s
Bit rate mode : Constant
Bit rate : 384 Kbps
Channel(s) : 6 channels
Channel positions : Front: L C R, Side: L R, LFE
Sampling rate : 48.0 KHz
Bit depth : 16 bits
Compression mode : Lossy
Stream size : 68.1 MiB (7%)

Audio #2
ID : 189 (0xBD)-129 (0x81)
Format : AC-3
Format/Info : Audio Coding 3
Mode extension : CM (complete main)
Format settings, Endianness : Big
Muxing mode : DVD-Video
Duration : 24mn 48s
Bit rate mode : Constant
Bit rate : 384 Kbps
Channel(s) : 6 channels
Channel positions : Front: L C R, Side: L R, LFE
Sampling rate : 48.0 KHz
Bit depth : 16 bits
Compression mode : Lossy
Stream size : 68.1 MiB (7%)

Audio #3
ID : 189 (0xBD)-130 (0x82)
Format : AC-3
Format/Info : Audio Coding 3
Mode extension : CM (complete main)
Format settings, Endianness : Big
Muxing mode : DVD-Video
Duration : 24mn 48s
Bit rate mode : Constant
Bit rate : 192 Kbps
Channel(s) : 1 channel
Channel positions : Front: C
Sampling rate : 48.0 KHz
Bit depth : 16 bits
Compression mode : Lossy
Stream size : 34.1 MiB (3%)

Text #1
ID : 189 (0xBD)-33 (0x21)
Format : RLE
Format/Info : Run-length encoding
Muxing mode : DVD-Video
Duration : 24mn 43s
Delay relative to video : 3s 400ms

Text #2
ID : 189 (0xBD)-34 (0x22)
Format : RLE
Format/Info : Run-length encoding
Muxing mode : DVD-Video
Duration : 24mn 43s
Delay relative to video : 3s 160ms

Text #3
ID : 189 (0xBD)-35 (0x23)
Format : RLE
Format/Info : Run-length encoding
Muxing mode : DVD-Video
Duration : 24mn 43s
Delay relative to video : 3s 480ms

Text #4
ID : 189 (0xBD)-36 (0x24)
Format : RLE
Format/Info : Run-length encoding
Muxing mode : DVD-Video
Duration : 24mn 43s
Delay relative to video : 3s 160ms

Text #5
ID : 189 (0xBD)-37 (0x25)
Format : RLE
Format/Info : Run-length encoding
Muxing mode : DVD-Video
Duration : 24mn 43s
Delay relative to video : 3s 160ms

Text #6
ID : 189 (0xBD)-38 (0x26)
Format : RLE
Format/Info : Run-length encoding
Muxing mode : DVD-Video
Duration : 24mn 43s
Delay relative to video : 3s 160ms

Text #7
ID : 189 (0xBD)-40 (0x28)
Format : RLE
Format/Info : Run-length encoding
Muxing mode : DVD-Video
Duration : 24mn 43s
Delay relative to video : 3s 160ms

Text #8
ID : 189 (0xBD)-32 (0x20)
Format : RLE
Format/Info : Run-length encoding
Muxing mode : DVD-Video

Text #9
ID : 189 (0xBD)-39 (0x27)
Format : RLE
Format/Info : Run-length encoding
Muxing mode : DVD-Video

Menu

StainlessS
11th November 2015, 00:11
Post #25 updated, general fiddling about.

EDIT: result of client script (extracting and showing only video Info [not audio/text etc]).

Import("CallCmd_MediaInfo.Avs")
Colorbars.killAudio
S=GetVideoInfo("VTS_01_1.VOB")
S = (S!="") ? RT_StrReplace(S,Chr(10),"\n") : S
Return SubTitle(String(S),lsp=0,Font="Courier New")


https://s20.postimg.cc/6irzgqjr1/Call_Cmd_zps3sybyzqe.jpg (https://postimg.cc/image/mts3d1w8p/)

And this would show, just "16:9".

Import("CallCmd_MediaInfo.Avs")
Colorbars.killAudio
S=GetAspectRatio("VTS_01_1.VOB")
Return SubTitle(String(S),lsp=0,Font="Courier New")

martin53
5th April 2016, 18:16
StainlessS,
would you please help checking if there might be a new Win10-related issue.
I use a loop of AviSynth Script calls to a Thumbsheet-Creator function (http://forum.doom9.org/showthread.php?p=1710421#post1710421) to make thumbsheets of a set of clips.
The thumbsheet creator uses the ImageWriter function, and to compress the Jpegs and remove the frame number from the filename, CallCmd calls ImageMagick's 'convert' and command prompt's 'del' at the closedown of the modified script in line 63
CallCmd(Close=
\"Cmd.exe /c P:\PortableApps\ImageMagick\convert " + chr(34) + JpgName +"000000.jpg" +chr(34) + " -quality 75 " + chr(34) + JpgName + ".jpg" + chr(34) + " && del " + chr(34) + JpgName +"000000.jpg" +chr(34),
\Hide=true, Synchronous=7)
I used this regularly and without obvious flaws for many months, for a while with 32bit AviSynth+ r1779, and recently updated from Win7 (x64) to Win10.

Now I observe that the thumbsheets all need a suspicious time of exactly 30 seconds to be created, and by some random cause, the time switches to exactly 30 minutes(!) per thumbsheet.

I'm unsure if the 'synchronous' parameter might be broken in Win10, so CallCmd runs into some sort of timeout.

Will change the outmost loop to do these operations outside the AviSynth script and report more findings.

EDIT
After commenting out line in AVS script and adding the commands in the calling AU3 script, processing time is not as stable at 30" as before, and issue is still there. So seems not to come from the CallCmd line but maybe from VirtualDub (which is the portable version 1.10.4 being called directly without the 'portable wrapper' because that is not needed here) or AviSynth+ itself.

AVS script is executed from AutoIt via:
RunWait("P:\PortableApps\VirtualDubPortable\App\VirtualDub\vdub.exe " & $s2 & " /cmd VirtualDub.RunNullVideoPass(); /x", "", @SW_HIDE)

AutoIt: 3.3.14.2, OS: WIN_10/X64, Script: MakeThumbsheets.au3
19970814 21.21.59.avi
20:00:56
19970814 22.18.40.avi
20:01:27
19970814 22.20.00.avi
20:01:58
19970814 22.20.18.avi
20:02:28
19970814 22.20.44.avi
20:02:58
19970814 22.21.27.avi
20:03:29
19970814 22.24.23.avi
20:04:00
19970814 22.24.43.avi
20:04:30
19970814 22.26.22.avi
20:05:01
19970815 22.27.48.avi
20:05:32
19970818 22.43.47.avi
20:06:26
19970818 22.45.48.avi
20:06:57
19970818 22.48.49.avi
20:36:58
19970818 22.51.32.avi
20:37:31
19970818 22.52.36.avi
20:38:01
19970818 22.53.43.avi
20:38:32
19970818 22.56.25.avi
20:39:03
19970818 22.57.46.avi
20:39:33
20:40:04
>>>>>> Please close the "Report Log Window" to exit <<<<<<<

EDIT2
will try AVSMeter instead of vdub NullVideoPass()

StainlessS
5th April 2016, 22:28
Mobile:

M53, I'm sorry, don't use/have win 10, me still happy on xp32.
Callcmd comes with source, you are perhaps best person to fix problem. If you have any questions on source then can post or PM and I'll do my best to assist.

StainlessS
6th April 2016, 23:38
You could perhaps try without HIDE, see if anything is waiting some keypress or something (or error message).

StainlessS
4th April 2018, 01:03
CallCmd v1.04, see first post.


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


Included Avsiynth v2.58, avs+ v2.6 x86, and Avs+ x64 dll's

dani75
14th June 2020, 22:37
Good morning everybody.
I just discovered CallCmd() (thanks to StainlessS) and I found it useful inside one of my scripts under AviSynth (still in 2.6.0) to call an executable I made. I installed the CallCmd_25_x86 library (my OS is W10 64 bits).
Unfortunately, I got a 0x00000057 issue. Therefore I replaced the original CallCmd I was working on by the following :
CallCmd(Last,Open=""" "cmd /C echo Hello world" """,Debug=True)
And I got the following on DebugView:
00000006 18.37546158 [10172] CallCmd: Constructor IN
00000007 18.37561607 [10172] CallCmd: CallCmd: v1.04 - 04 Apr 2018 - by StainlessS
00000008 18.37573242 [10172] CallCmd: Command for Frames = ''
00000009 18.37584686 [10172] CallCmd: Open Command (Constructor) = ' "cmd /C echo Hello world" '
00000010 18.37596893 [10172] CallCmd: FRAMES: About to Parse Frames String
00000011 18.37610626 [10172] CallCmd: Doing command on 0 Frames
00000012 18.37621689 [10172] CallCmd: Open (Constructor) on command ' "cmd /C echo Hello world" '
00000013 18.38459778 [10172] CallCmd: *** ERROR *** Creating Process Paramètre incorrect. (0x00000057)
00000014 18.38466263 [10172] CallCmd: Constructor OUT
00000015 18.59652138 [10172] [ 0] type=I Q: 2 length: 78642
00000016 18.66365051 [10172] CallCmd: Destructor IN
00000017 18.66374779 [10172] CallCmd: Destructor OUT

Does that say anything to someone?

StainlessS
14th June 2020, 23:40
Too many double quotes.

BlankClip
CallCmd(Last,Open="""cmd /C echo Hello world & pause""",Debug=True)


I've added "& pause" where "&" means new command, (ie multiple commands on single line), and "pause" to wait, so you can see it.
hit a key and it goes away.

EDIT: If you're on avs v2.60 x86, maybe should use "CallCmd_x86_1.04.dll" and rename to just "CallCmd.dll". [the one you are using is for avs v2.58]

dani75
14th June 2020, 23:57
I tried it, even with "CallCmd_x86.dll". Sorry, no change at all, except in the instruction line :
[9932] CallCmd: Constructor IN
[9932] CallCmd: CallCmd: v1.04 - 04 Apr 2018 - by StainlessS
[9932] CallCmd: Command for Frames = ''
[9932] CallCmd: Open Command (Constructor) = ' cmd /C echo Hello world & pause '
[9932] CallCmd: FRAMES: About to Parse Frames String
[9932] CallCmd: Doing command on 0 Frames
[9932] CallCmd: Open (Constructor) on command ' cmd /C echo Hello world & pause '
[9932] CallCmd: *** ERROR *** Creating Process Paramètre incorrect. (0x00000057)
[9932] CallCmd: Constructor OUT
[9932] [ 0] type=I Q: 2 length: 78642
[9932] CallCmd: Destructor IN
[9932] CallCmd: Destructor OUT

StainlessS
15th June 2020, 00:04
Can someone with W10 and Avs installed try out the script in post #33, thanks.

StainlessS
15th June 2020, 12:45
I installed Avs+ 3.61 test 8 on Win10 Home 1709, x86 Tablet/Laptop thingy, and runs post #33 script OK.
Can you try with Anti Virus turned off, dont know what else to suggest.

EDIT: Maybe also post result of "AvsMeter AvsInfo -l".

EDIT:
Groucho, what is red stuff below supposed to be ? [for post #33 script, below done on W7]

d:\TESt>avsmeter callcmd.avs

AVSMeter 3.0.1.0 (x86), (c) Groucho2004, 2012-2020
AviSynth+ 3.6.1 (r3290, master, i386) (3.6.1.0)
Hello world pt...
Press any key to continue . . .

Groucho2004
15th June 2020, 13:33
Groucho, what is red stuff below supposed to be ? [for post #33 script, below done on W7]

d:\TESt>avsmeter callcmd.avs

AVSMeter 3.0.1.0 (x86), (c) Groucho2004, 2012-2020
AviSynth+ 3.6.1 (r3290, master, i386) (3.6.1.0)
Hello world pt...
Press any key to continue . . .
It works if you escape the '&' with '^':
CallCmd(Last,Open="""cmd /C echo Hello world ^& pause""",Debug=True)

StainlessS
15th June 2020, 13:42
It works if you escape the '&' with '^':
I get this with
CallCmd(Last,Open="""cmd /C echo Hello world ^& pause""",Debug=True)


d:\TESt>avsmeter callcmd.avs

AVSMeter 3.0.1.0 (x86), (c) Groucho2004, 2012-2020
AviSynth+ 3.6.1 (r3290, master, i386) (3.6.1.0)
Hello world & pause
Hello world & pause

Number of frames: 240
Length (hh:mm:ss.ms): 00:00:10.000
Frame width: 640
Frame height: 480
Framerate: 24.000 (24/1)
Colorspace: RGB32
Audio channels: 1
Audio bits/sample: 16
Audio sample rate: 44100
Audio samples: 441000

Script runtime is too short for meaningful measurements

Frames processed: 240 (0 - 239)
Time (elapsed): 00:00:00.000

d:\TESt>

The intended pause does not work. EDIT: in my prev post you can see the pause, "Press any key to continue . . .".

Groucho2004
15th June 2020, 13:50
The intended pause does not work. EDIT: in my prev post you can see the pause, "Press any key to continue . . .".Oh, I see. I'll try to figure it out. I don't even know what this plugin is supposed to do...

Edit - It seems to work as intended with avsr.

StainlessS
15th June 2020, 14:08
I don't even know what this plugin is supposed to do
Plugin to execute command on selectable frames or at startup or closedown. Based on Call() by Nic.

I'll try also with avsr.

For "Hello world pt...", I was just kinda curious what the 'pt' thing stood for, presumably to represent Ampersand '&'.

EDIT: One of its main uses was to delete files prior to RT_Stats RT_FileDelete().
Also, eg call ImageMagick to operate on an image/frame, and then reload result into script + many other possibilities.

EDIT: also, can set to delete some file on clip destructor, ie delete temp files on clip/script closure.

Groucho2004
15th June 2020, 14:19
I'm using fputs() instead of vfprintf() in AVSMeter which is probably the problem. I made that change when some GUI capture didn't work (I think it was ripbot). I'm considering to revert that change.

StainlessS
15th June 2020, 15:07
(I think it was ripbot). I'm considering to revert that change.
I think was Ripbot too. [be careful not to break Ripbot, you know how emotional Atak_Snajpera can get ( :) )].

Groucho2004
15th June 2020, 15:52
I think was Ripbot too. [be careful not to break Ripbot, you know how emotional Atak_Snajpera can get ( :) )].Well then, maybe you can use avsr for the time being?

Groucho2004
15th June 2020, 16:20
I think was Ripbot too. [be careful not to break Ripbot, you know how emotional Atak_Snajpera can get ( :) )].I checked, ripbot is using a 3 year old version of AVSMeter so I think I can go ahead with that regression.

StainlessS
15th June 2020, 16:27
I'm wondering if this has anything to do with the CallCmd problem,
Recent Windows 10 updates block programs from running:- https://www.bleepingcomputer.com/news/microsoft/recent-windows-10-updates-block-programs-from-running/
Works OK on my W10 Home with 1709 and no recent updates [no updates for longish time, 1709 no-longer supported by M$].

EDIT:
Dear me, this BLM thing is way bananas, [Political correctness escalates by a few factors of ten, was already crazy]

GitHub to replace "master" with alternative term to avoid slavery references
However, their second choice of 'slaveowner' may not be much better.
https://www.zdnet.com/article/github-to-replace-master-with-alternative-term-to-avoid-slavery-references/

Groucho2004
15th June 2020, 16:42
I'm wondering if this has anything to do with the CallCmd problem,
Recent Windows 10 updates block programs from running:- https://www.bleepingcomputer.com/news/microsoft/recent-windows-10-updates-block-programs-from-running/
Works OK on my W10 Home with 1709 and no recent updates [no updates for longish time, 1709 no-longer supported by M$]
I can reproduce it on W7.

StainlessS
15th June 2020, 16:44
You can reproduce this ?
I tried it, even with "CallCmd_x86.dll". Sorry, no change at all, except in the instruction line :
[9932] CallCmd: Constructor IN
[9932] CallCmd: CallCmd: v1.04 - 04 Apr 2018 - by StainlessS
[9932] CallCmd: Command for Frames = ''
[9932] CallCmd: Open Command (Constructor) = ' cmd /C echo Hello world & pause '
[9932] CallCmd: FRAMES: About to Parse Frames String
[9932] CallCmd: Doing command on 0 Frames
[9932] CallCmd: Open (Constructor) on command ' cmd /C echo Hello world & pause '
[9932] CallCmd: *** ERROR *** Creating Process Paramètre incorrect. (0x00000057)
[9932] CallCmd: Constructor OUT
[9932] [ 0] type=I Q: 2 length: 78642
[9932] CallCmd: Destructor IN
[9932] CallCmd: Destructor OUT


EDIT: with this script [command called on filter constructor]

BlankClip
CallCmd(Last,Open="""cmd /C echo Hello world & pause""",Debug=True)


EDIT: Source

bool __stdcall CallCmd::DoCall(int n) {
STARTUPINFO stinfo;
PROCESS_INFORMATION pinfo;
char *d;
int i;
// Clear the structures
for(d=(char*)&stinfo,i=sizeof(STARTUPINFO); --i>=0; d[i]='\0');
for(d=(char*)&pinfo,i=sizeof(PROCESS_INFORMATION); --i>=0; d[i]='\0');
stinfo.cb = sizeof(STARTUPINFO);

DWORD fdwCreate = (Hide) ? CREATE_NO_WINDOW : 0; // Hide Console Window ?

d=pcmd;

const char *s;

bool wait = false;


SetLastError(ERROR_SUCCESS);

// CreateProcessW can modify the command string and so cannot be const,
// WE CONSIDER NON CONST ANYWAY even though NOT using CreateProcessW.
if(n== -1 ) { //# constructor call
s=Open;
for(;*d++=*s++;);
if(dbg)dprintf("Open (Constructor) on command '%s'",pcmd);
wait = ((Sync & 0x01)!=0);
} else if(n== -2) {

Groucho2004
15th June 2020, 16:46
Dear me, this BLM thing is way bananas, [Political correctness escalates by a few factors of ten, was already crazy]


https://www.zdnet.com/article/github-to-replace-master-with-alternative-term-to-avoid-slavery-references/This reminds me of the "Two Towers" controversy. Shortly after 9/11 the second part of The Lord Of The Rings was about to be released and a bunch of idiots suggested that it would have to be re-named because of the recent event.

Groucho2004
15th June 2020, 16:55
You can reproduce this ?Maybe I misunderstood, I meant I can reproduce this:

https://i.postimg.cc/fWV3hDsb/Image1.png

https://i.postimg.cc/L8xRXgBF/Image2.png

StainlessS
15th June 2020, 17:09
Oops, the prev posted

if(n== -1 ) { //# constructor call
stuff just preps and shows debug,

missed this bit out from source, the actual command caller

int success = CreateProcess(
NULL, // ApplicationName, name of executable. NULL, name is in Commandline instead
pcmd, // CommandLine, command line string, Cannot be const (CreateProcessW).
NULL, // Process Attributes, NULL, the handle cannot be inherited
NULL, // ThreadAttributes, NULL=the handle cannot be inherited
FALSE, // handle inheritance option, Dont inherit
fdwCreate, // creation flags
NULL, // new environment block
NULL, // current directory name, same as ours
&stinfo, // startup information
&pinfo // process information
);