Main Menu

stay-open not closing

Started by richnuthouse, December 28, 2020, 02:29:18 PM

Previous topic - Next topic

richnuthouse

I'm executing EXIFTool from Windows .bat file containing stay-open command referring to a text file to process many images in one command.
All works great except cmd process running EXIFtool never closes. When I go to task manager and end EXIFTool process. Windows stops EXIFTool and closes cmd window.

Interestingly, task manager shows two running EXIFTool processes and two cmd related processes, but if I end any one of them, they all close. This is on a 64 bit machine if that makes any difference.

Right now, I'm just in testing with a couple of images. My .bat file contains the following:
"exiftool -stay_open True -@ D:\DocumentsD\CERSlideLibrary\EXIFTools\tempargs.txt"

tempargs.txt file contains the following:
-IFD0:all=
-EXIF:createdate="1942:01:01 12:00:00"
-xmp:description="1942    219 8th Avenue"
D:\DocumentsD\CERSlideLibrary\Photos\Inbound_preEXIF\B001-01_v2.jpg
-execute
-IFD0:all=
-EXIF:createdate="1942:01:01 12:01:00"
-xmp:description="1942    Memory Grove from 8th Ave. "
D:\DocumentsD\CERSlideLibrary\Photos\Inbound_preEXIF\B001-02_v2.jpg
-execute
-IFD0:all=
-EXIF:createdate="1942:01:01 12:02:00"
-xmp:description="1942    Capitol Building"
D:\DocumentsD\CERSlideLibrary\Photos\Inbound_preEXIF\B001-03_v2.jpg
-execute
-IFD0:all=
-EXIF:createdate="1944:01:01 12:00:00"
-xmp:description="1944    The Old Pierce Montpelier Home"
D:\DocumentsD\CERSlideLibrary\Photos\Inbound_preEXIF\B001-04_v2.jpg
-execute
-IFD0:all=
-EXIF:createdate="1943:01:01 12:00:00"
-xmp:description="1943    Saltair"
D:\DocumentsD\CERSlideLibrary\Photos\Inbound_preEXIF\B001-05_v2.jpg
-execute
-stay_open\nFalse\n

Any guidance?

StarGeek

I believe the \n is notation for a new line.  So try
-stay_open
False
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

richnuthouse

Worked!! Thankyou!

I'm creating the batch file and argument text file using VBA in Excel. I'm using a dummy text file to wait until bat file completes processing to end the subroutine. Here's the code if anyone is interested... This routine updates the createdate and XMP description for all the jpegs in a library using an external index in Excel. Note: I created the .jpegs from TIFFs using Windows Image Acquisition objects and for some reason Exiftool did not like certain resulting IFD0 tags, so I'm deleting them with the "-IFD0:all=" command. 

With New FileSystemObject
    If .FileExists(strDirEXIFTool & "Tempargs.txt") Then
        .DeleteFile strDirEXIFTool & "Tempargs.txt"
    End If
End With
With New FileSystemObject
    If .FileExists(strDirEXIFTool & "TempList.bat") Then
        .DeleteFile strDirEXIFTool & "TempList.bat"
    End If
End With
' Create Batch File
Set fs = CreateObject("Scripting.FileSystemObject")
Set flArgs = fs.CreateTextFile(strDirEXIFTool & "Tempargs.txt", True)
Set flBat = fs.CreateTextFile(strDirEXIFTool & "TempList.bat", True)
' Use batch file to copy a small text file into the inbound directory.  This file will be used to validate batch file is complete
With New FileSystemObject
    If .FileExists(strDirInbound & "wait.txt") Then
        .DeleteFile strDirInbound & "wait.txt"
    End If
End With
strCommand = "cd /d " & strDirEXIFTool
flBat.WriteLine (strCommand)
strCommand = "copy " & strDirEXIFTool & "wait.txt " & strDirInbound
flBat.WriteLine (strCommand)
strCommand = "exiftool -stay_open True -@ " & strDirEXIFTool & "tempargs.txt"
flBat.WriteLine (strCommand)
' Create batch file. Check to make sure file exists before adding to batch file list.
intRow = 1
intRows = rngTempList.Rows.Count
' loop through all the files for which to change the EXIF data
Do While intRow <= intRows
    strFileN = rngTempList.Cells(intRow, 1).Value
    dtCreate = rngTempList.Cells(intRow, 2).Value
    strCaption = rngTempList.Cells(intRow, 3).Value
    strCreate = Format(dtCreate, "yyyy:mm:dd hh:nn:ss")
    strCommand = "-IFD0:all="
    flArgs.WriteLine (strCommand)
    strCommand = "-EXIF:createdate=""" & strCreate & """"
    flArgs.WriteLine (strCommand)
    strCommand = "-xmp:description=""" & strCaption & """"
    flArgs.WriteLine (strCommand)
    strCommand = strDirInbound & strFileN
    flArgs.WriteLine (strCommand)
    strCommand = "-execute"
    flArgs.WriteLine (strCommand)

    intRow = intRow + 1
Loop
strCommand = "-stay_open"
flArgs.WriteLine (strCommand)
strCommand = "false"
flArgs.WriteLine (strCommand)
flArgs.Close
strCommand = "del " & strDirInbound & "*_original"
flBat.WriteLine (strCommand)
strCommand = "move /Y " & strDirInbound & "*.jpg" & " " & strDIRArchive
flBat.WriteLine (strCommand)
strCommand = "del " & strDirInbound & "wait.txt"
flBat.WriteLine (strCommand)
flBat.Close
' Execute batch, keep open process waiting for batch to complete
Shell strDirEXIFTool & "Templist.bat", vbNormalFocus
While Len(Dir(strDirInbound & "wait.txt")) > 0
DoEvents
Wend