Stay_open via Standard input

Started by BogdanH, October 22, 2011, 01:58:07 PM

Previous topic - Next topic

BogdanH

Hi James,

I could achive that after Phil gave me few important hints/ideas (at least for my approach). Most important for me, was -echo command, which can be used at the very end of all commands sent to ExifTool. For example:
...
-execute
...
-execute
-xmp:subject
-execute
-echo
XYZ
-execute

-here, data from StdOutput must be readed until (in this case) XYZ "signature" arrives. This hint opened my eyes: instead of sending -echo (which I'm still doing for test purposes), I can simply send i.e. -execute99 at the end (say, as "final" execute) and then read data from StdOutput until {ready99} arrives -which eliminates -echo usage entirely for this purpose, I believe.
In both cases, reading data from StdOutput goes fast, because no repeated "wait" is needed to check for "in case more data is to come from ExifTool".
And Phil also mentioned, that after recieving "final" {ready}, no more error messages will be sent from ExifTool (if there are any). That is, on last {ready} from StdOutput, data in StdError is ready to be pulled fast (that is, without repeated "wait few milliseconds").

To sumarize, I actually had two problems:
1. How to properly adapt my existing code (as used in GUI -see: https://exiftool.org/gui/articles/ ) for totally new kind of ExifTool usage. Code actually didn't change much, compared to what I allready had in GUI... except input pipe is needed for sending commands to ExifTool.
The most importand difference is, in "normal" ExifTool usage, ExifTool terminates automatically after finishing job. This is not the case in stay_open mode: here, ExifTool "listen" for command(s) you may send all the time.

2. Truly understanding how -stay_open actually works. To achieve that, some practicing in console window was needed.

Bogdan