To get exiftool help when using exiftool.exe in the Windows command window, I just enter exiftool<CR> and all of the exiftool help text is shown.
I would like to get that same text at runtime when I'm using -stay_open. I understand why just sending -execute with no previous input since the last -execute does not work because then in the situation when an 'empty' -execute needs to be sent to get the {ready} response when the -q or -T options are used, would then generate a lot of output (all the help text).
So I was hoping that there is an option I can send exiftool to have it return the help text, maybe something like -help or -? ?
Or maybe there is another 'easy' way to get the help text at runtime when using -stay_open?
Thanks!
Curtis
Hi Curtis,
Interesting. I never thought of this. In general, one does "perldoc exiftool" to get the help, but that doesn't work with the Windows version. I'll think about adding a -help option.
- Phil
Thanks for considering it! :)
Hi Curtis,
I looked into this. Getting the help via -stay_open is a bit problematic since it uses a pager which requires keyboard input to page through the document. I don't know of a good way to handle this.
- Phil
That's OK, for now I ran exiftool once and piped the output to a .txt file and then in my program I just read that file in. But, when exiftool help documentation changes with later versions I will not have the latest help text....
Hmmm..... maybe I'll try during my program initialization to run exiftool once in a process and NOT use -stay_open, pipe output to a file then read that .txt file. That way my help file will always match the exiftool.exe that I am currently using. Hah! solved (I hope) :D
Curtis
Got that working! So I just start exiftool, get all output, since I can't wait for {ready} I just wait until the exiftool process has exited.
Curtis ;D
For anyone interested here is the vb.net code to run exiftool once and get the help text it outputs:
Private Shared _ExifToolHelpString As String = ""
Public Shared Function ExifToolHelp() As String
If String.IsNullOrEmpty(_ExifToolHelpString) AndAlso Not String.IsNullOrEmpty(ExifToolExeFn) Then
With New Process
.StartInfo.FileName = ExifToolExeFn '<-- need to set this to where ever you are getting your exiftool.exe file from
.StartInfo.UseShellExecute = False
.StartInfo.RedirectStandardOutput = True
.StartInfo.RedirectStandardError = True
.StartInfo.CreateNoWindow = True
.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
AddHandler .OutputDataReceived, AddressOf HelpOutputDataHandler
.Start()
.BeginOutputReadLine()
'--wait for exiftool to finish and exit
Do Until .HasExited
Thread.Sleep(20)
Loop
RemoveHandler .OutputDataReceived, AddressOf HelpOutputDataHandler
.Close()
_ExifToolHelpString = stdoutHelpString.ToString
End With
End If
Return _ExifToolHelpString
End Function
Private Shared stdoutHelpString As New StringBuilder
Private Shared Sub HelpOutputDataHandler(sender As Object, args As DataReceivedEventArgs)
If args.Data IsNot Nothing Then
'--handles each ReadLine
'--args.data is a single line of the output, but does not end with a CRLF, so we need to add that
stdoutHelpString.Append(args.Data)
stdoutHelpString.Append(ControlChars.CrLf)
End If
End Sub
Great. And thanks for posting the vb.net code.
- Phil