.bat file to print captions to a text file

Started by Table, August 01, 2023, 05:27:27 PM

Previous topic - Next topic

Table

Hello,

Could someone help to create two .bat files to print captions to a text file? I have exiftool.exe already on my computer.

What I'm hoping to accomplish is to possibly be able to select a jpg in a folder full of pictures in File Manager of Windows 10. Then there could be an option to "Send to" so that I could select the .bat file to run it. Someone helped me to set up a similar technique for printing file lists to a text file.

For the jpegs, there should be two separate .bat files. One for IPTC data and one for XMP data.

Following are two .bat files that were created for me many years ago to run with Picasa. However, I want it to run while in File Manager in Windows 10.

This is for XMP data.

@echo off

:: initialise some variables that can be practical...
set BatFileDir=%~dp0
set SelFile=%1
set SelDir=%~dp1

:: Start to do the real work
echo This is the first selected file in Picasa:
echo Selected file: %SelFile%
echo Selected dir: %SelDir%
echo.
echo Create file with captions of all .jpg files in Selected dir
"%BatFileDir%\exiftool.exe" -q -f -printformat "--- $filename ---$/$xmp:description$/" "%SelDir%\*.jpg" > "%SelDir%\Captions.txt"
echo Created Captions.txt for all .jpg's in folder %SelDir%
notepad.exe "%SelDir%\Captions.txt"

:: Pause if error...
if %errorlevel% neq 0 pause


Here is a .bat file for IPTC data:
@echo off

:: initialise some variables that can be practical...
set BatFileDir=%~dp0
set SelFile=%1
set SelDir=%~dp1

:: Start to do the real work
echo This is the first selected file in Picasa:
echo Selected file: %SelFile%
echo Selected dir: %SelDir%
echo.
echo Create file with captions of all .jpg files in Selected dir
"%BatFileDir%\exiftool.exe" -q -f -printformat "--- $filename ---$/$IPTC:Caption-abstract$/" "%SelDir%\*.jpg" > "%SelDir%\Captions.txt"
echo Created Captions.txt for all .jpg's in folder %SelDir%
notepad.exe "%SelDir%\Captions.txt"

:: Pause if error...
if %errorlevel% neq 0 pause


The end result is that the text file will nicely display the file name with dashes, and the caption below it, such as in this example:

--- 2023_07_28_picture_002.JPG ---
This is a picture.

--- 2023_07_28_picture_005.JPG ---
This is another picture.


Thanks!

StarGeek

I don't believe there is anything you can edit on a bat file to add it to the "Send To" menu.  They're separate systems.

I'm pretty sure there are programs that can do this for you.  Actually, a quick search found this page which makes it look like you just have to create a short cut to your bat files.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Table

Thanks for directions how to add it to the "Send to" menu.

I'm still hoping someone can edit or rewrite the 2 bat files I posted so that they will work in File Manager rather than in Picasa.

StarGeek

Quote from: Table on August 02, 2023, 04:22:01 AMI'm still hoping someone can edit or rewrite the 2 bat files I posted so that they will work in File Manager rather than in Picasa.

That would require a Windows forum.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).