Use of uninitialized value $info - in pattern match

Started by sevy, July 05, 2022, 02:02:55 PM

Previous topic - Next topic

sevy

Hello,

I have the following command in a bat file (in order to process many pdf files at once) :
exiftool.exe -progress -L -if "not $subject=~/abpdf/" -xmp:subject+="abpdf" -pdf:keywords+="abpdf" -ext pdf -overwrite_original "directory"

It was ok until version 12.40. Starting version 12.41, no more add of keyword.
After adding -v to the command, I received the following error message :
Warning: Shift value for XMP-pdf:Subject is not a number
Condition: Use of uninitialized value $info{"subject"} in pattern match (m//)


I don't understand why this command was ok ... and is no more ok.

I tried to find to solve the problem... the only one until now is to continue to use the version 12.40. Does anyone have another idea ?

thanks in advance,

sevy

StarGeek

Try using
-xmp-dc:subject+="abpdf"
That will force the writing of the tag you actually want and ignore the XMP-pdf tag.

The "Shift value" warning occurs because XMP-pdf:Subject is neither a number nor a list type tag.  But the "uninitialized value" error is something that Phil will have to look at when he get's back from vacation.
"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

Phil Harvey

Quote from: StarGeek on July 05, 2022, 02:12:57 PM
the "uninitialized value" error is something that Phil will have to look at when he get's back from vacation.

This happens because you are not testing to see if $subject exists.  If you want the condition to be satisfied if there is no previous subject, do this:

-if "not $subject or not $subject=~/abpdf/"

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

StarGeek

Ah, so that's part of the Windows fix in ver 12.41.
Fixed long-standing problem where Windows version could behave differently for -if conditions containing undefined tags

I'll have to remember this.
"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

sevy