Calling external programs with path of photo

Ask for help and post your question on how to use XnView MP.

Moderators: XnTriq, helmut, xnview

LuNik
Posts: 27
Joined: Thu Aug 04, 2022 8:24 am

Calling external programs with path of photo

Post by LuNik »

Hi,
from the Tools|Open with ... menu I want to call exiftool with the selected photo to chang some exif information. Therefore I created a little batch file to call exiftool.exe. Parameter %1 is the name of the selected photo. But what I need is the Path to the photo as well.

Is there a chance to call an external programs with more parameters(arguments) than just the filename? The dialogue "Configure programs" shows a column titled "Arguments" but nothing is shown there and I didn't find a way to add more arguments ...

Thanks for you help and best regards
Ludger
User avatar
michel038
XnThusiast
Posts: 1165
Joined: Tue Sep 27, 2016 8:18 am
Location: France

Re: Calling external programs with path of photo

Post by michel038 »

Hello,
I wrote a post about "Open with" and ExifTool there : viewtopic.php?p=183222#p183222

When "Open with" calls a BAT file, this syntax can be used in the batch :

Code: Select all

C:\XnViewMP\AddOn\exiftool "-iptc:city=London" %*
where %* will contain the selected files in XnViewMP browser
LuNik
Posts: 27
Joined: Thu Aug 04, 2022 8:24 am

Re: Calling external programs with path of photo

Post by LuNik »

Merci Michel!!!
That helped a lot. I got exiftool working together with XnViewMP as I intended.

The key was that I didn't had the idea to double click the arguments column to add a parameter! Help (?) isn't working in that dialogue :(

Just in case I need to pass a parameter to let's say a batch file.... Is the a list of all the arguments possible that can be passed over? Is there any documentation?

Merci beaucoup
Ludger
LuNik
Posts: 27
Joined: Thu Aug 04, 2022 8:24 am

Re: Calling external programs with path of photo

Post by LuNik »

Do be more precise: What I want to know is whether any placeholders/variables can be used as an argument for calling an external program?! I can't find any documentation for that.
I found something general about placeholders in the wiki but that didn't work. For example {Folder} is treated as a string/literal not as a variable.
Is the usage of variables/placeholders as an argument for calling external programs supported by XnViewMP or not ???

Merci and best regards
Ludger
User avatar
michel038
XnThusiast
Posts: 1165
Joined: Tue Sep 27, 2016 8:18 am
Location: France

Re: Calling external programs with path of photo

Post by michel038 »

Perhaps with
Metadata > Transfer
... you can get the result you want ?

- Select jpgs
- Metadata>Transfer
- Add target field
- Select source data with the drop-down arrow
- You can edit this field (type text, separators, add other fields ...)

----

Other way, in the batch file, you can ask for exiftool to extract the data , and this is a method to put this data in a variable :

Code: Select all

@ echo off
setlocal enabledelayedexpansion
:files
if x%1==x goto end
for /f "delims=" %%i in ('C:\Tool\exiftool.exe -m -p "$iptc:city" %1') do (
	set "result=%%i"
	echo !result!
	rem Here you can add commands that are using !result! as a parameter
	shift
)
goto files
:end
pause
...with the help of chatgpt
Last edited by michel038 on Wed Nov 15, 2023 7:10 pm, edited 1 time in total.
LuNik
Posts: 27
Joined: Thu Aug 04, 2022 8:24 am

Re: Calling external programs with path of photo

Post by LuNik »

Merci beaucoup Michel!

With your help my problem to call exiftool with some parameters is solved! Thank you very much - merci!
The problem in my case was that the path contained some spaces. :?

Your solution with Metadata|Transfer works as well but is less convenient for me.

My (additional) question concerned placeholders as an argument in the "Open with|Configue Programs ..." dialogue.
Are any placeholders/variables supported? Something like {File}, {Folder}, {Drive} ...? What would be the correct syntax?



Best regards
Ludger
User avatar
michel038
XnThusiast
Posts: 1165
Joined: Tue Sep 27, 2016 8:18 am
Location: France

Re: Calling external programs with path of photo

Post by michel038 »

My (additional) question concerned placeholders as an argument in the "Open with|Configue Programs ..." dialogue.
Are any placeholders/variables supported? Something like {File}, {Folder}, {Drive} ...? What would be the correct syntax?
I'm pretty sure this feature doesn't exist yet.
If you have any examples that show the benefits that this would bring, you can post them in the MP suggestions section of the forum, Pierre (Xnview) often implements new features.