Author Topic: Multiple If & No file specified  (Read 148 times)

mulu

  • Jr. Member
  • **
  • Posts: 27
Multiple If & No file specified
« on: March 27, 2020, 12:24:07 PM »
I read some threads about multiple if statements but I can't get it to work. Here is what I have:

"exiftool(-k).exe"

-config acdsee-rs.config

-if "defined $RegionInfoACDSeeAppliedToDimensionsw and $orientation=~/Rotate 270 CW|Rotate 90 CW/ and RegionInfoACDSeeAppliedToDimensionsw neq ImageHeight" "-RegionInfoACDSeeAppliedToDimensionsw<ImageHeight" "-RegionInfoACDSeeAppliedToDimensionsh<ImageWidth" -execute

-if "defined $RegionInfoACDSeeAppliedToDimensionsw and not $orientation=~/Rotate 270 CW|Rotate 90 CW/ and RegionInfoACDSeeAppliedToDimensionsw neq ImageWidth" "-RegionInfoACDSeeAppliedToDimensionsw<ImageWidth" "-RegionInfoACDSeeAppliedToDimensionsh<ImageHeight"

-r -P -overwrite_original_in_place "C:\temp\myimage.jpg"

This returns
No file specified
   1 image files updated

It's actually a conflicting message. On hand it says that no file was specified but then it also says 1 image file was updated. Note, the separation on multiple lines is just for this post so it's easier to see what I am doing. In reality this is one single, long line.

StarGeek

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 3684
Re: Multiple If & No file specified
« Reply #1 on: March 27, 2020, 12:52:37 PM »
It's actually a conflicting message. On hand it says that no file was specified but then it also says 1 image file was updated.

No, it's not conflicting.  See the docs on the -execute option.  Your command breaks down like this.

exiftool(-k).exe -config acdsee-rs.config -if "defined $RegionInfoACDSeeAppliedToDimensionsw and $orientation=~/Rotate 270 CW|Rotate 90 CW/ and RegionInfoACDSeeAppliedToDimensionsw neq ImageHeight" "-RegionInfoACDSeeAppliedToDimensionsw<ImageHeight" "-RegionInfoACDSeeAppliedToDimensionsh<ImageWidth"

Then the -execute starts a new command. Note that there is no filename in that part of the command.

exiftool(-k).exe -config acdsee-rs.config -if "defined $RegionInfoACDSeeAppliedToDimensionsw and not $orientation=~/Rotate 270 CW|Rotate 90 CW/ and RegionInfoACDSeeAppliedToDimensionsw neq ImageWidth" -RegionInfoACDSeeAppliedToDimensionsw<ImageWidth" "-RegionInfoACDSeeAppliedToDimensionsh<ImageHeight" -r -P -overwrite_original_in_place "C:\temp\myimage.jpg"

The -config option carries over (see the docs linked) but nothing else does.  The first command does not have access to the -r -P -overwrite_original_in_place "C:\temp\myimage.jpg"

You need to add the -Common_Args option option at the end
-Common_Args -r -P -overwrite_original_in_place "C:\temp\myimage.jpg"
Troubleshooting hints:
* When posting, include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).
* Double all percent signs (%) in a Windows batch file.
* If your GPS coords are negative, make sure and set the GpsLatitudeRef and GpsLongitudeRef tags correctly.

mulu

  • Jr. Member
  • **
  • Posts: 27
Re: Multiple If & No file specified
« Reply #2 on: March 27, 2020, 05:02:04 PM »
@StarGeek, ahh I thought -Common_Args is a place holder(!) for the common arguments. Instead, this is a keyword/option after which common arguments follow. I should have realized this since it's written as -Common_Args and not something like [Common_Args]. Thanks a lot!