Place holder

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

Moderators: helmut, XnTriq, xnview

User avatar
xnview
Author of XnView
Posts: 45870
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Place holder

Post by xnview »

In many places of XnView/XnConvert, you can use placeholder. A placeholder is between {}
493px-MP-PlaceHolder.png

Variables

All variables are between {}. You can cut a part of the text

• {variable [start-end]}
• {variable [start-]}
• {variable [-end]}

eg.

• {Filename} => img_example_105
• {Filename [0-2]} => img
• {Filename [5-]} => example_105
• {Filename [-7]} => img_exam

You can replace a word by another by using [~xxx~xxx]

eg.

• {Filename [~img~out]} => out_example_105

You can hide a variable if the value is empty: ((Model: {EXIF:Model}))

Date format

Date variable can be customized, by default system format is used.

• Y - Year
• y - Year without century (00-99)
• m - Month as decimal (01-12)
• d - Day as decimal (01-31)

• H - Hour (01-24)
• M - Minute (00-59)
• S - Second (00-59)

• B - Month name
• b - Abbreviated month name
• A - Weekday name
• a - Abbreviated weekday name

eg.

{Creation Date [Ymd-HMS]} -> 20211202-092920
{Creation Date [A B Y]} -> wednesday march 2021

EXIF variables

You can set an EXIF field by using his tag value, eg. {EXIF:x110}
You do not have the required permissions to view the files attached to this post.
Pierre.
User avatar
Gerald_Ire
Posts: 107
Joined: Wed Nov 11, 2020 12:37 pm
Location: Germany

Re: Place holder

Post by Gerald_Ire »

Hi Pierre,
...can you add "system user" or "login user" or "computer suer" from the OS as a variable to this list?
-------------------------------------------------------------------------------
:D Gerald says thx to all! :D
talon
Posts: 2
Joined: Wed Sep 07, 2022 5:00 pm

Re: Place holder

Post by talon »

Example 1: "20250322_110102 This is a super cool image.jpg"
Example 2: "20250322_110102.jpg"

((Info: {Filename [16-]}))

Result 1: "Info: This is a super cool image"
Result 2: "Info: 20250322_110102"
Result 2 desired: ""

If substring is empty or out of boundary, it would be nice if the result is empty and not returning full string.
Maybe it can be done by a new option, e.g. [16~] (more tolerant tilde instead of hyphen :-))

Also it would be helpful if regular expression is supported for replacements in filename, not just plain replacement like "{Filename [~img~out]}".
It could be an ordinary regular expression replace function where the result is used,
e.g. (perl style) s/(\d{8}_\d{6})?(.*)/$2/
This example suppresses the date string at begin.