• Welcome to the Lightroom Queen Forums! We're a friendly bunch, so please feel free to register and join in the conversation. If you're not familiar with forums, you'll find step by step instructions on how to post your first thread under Help at the bottom of the page. You're also welcome to download our free Lightroom Quick Start eBooks and explore our other FAQ resources.
  • Stop struggling with Lightroom! There's no need to spend hours hunting for the answers to your Lightroom Classic questions. All the information you need is in Adobe Lightroom Classic - The Missing FAQ!

    To help you get started, there's a series of easy tutorials to guide you through a simple workflow. As you grow in confidence, the book switches to a conversational FAQ format, so you can quickly find answers to advanced questions. And better still, the eBooks are updated for every release, so it's always up to date.

Plugin to do math/arithmatic on metadata fields

Status
Not open for further replies.

Califdan

Senior Member
Lightroom Guru
Premium Classic Member
Premium Cloud Member
Joined
May 9, 2015
Messages
2,334
Location
Palo Alto, CA
Lightroom Experience
Power User
Lightroom Version
Classic
Lightroom Version Number
10.2
Operating System
  1. Windows 10
Hi,

I found myself with a stange problem. In need to decrease the numeric portion of file name in a large number of images by a value of 1. In other words IMG1234.jpg needs to become IMG1233.jpg. As the LR plugin API does not suppoort file name manipulation in plugin's it seems that one can use Jfriedl's "write Data Field" plug in (in bog-o-goodies" collection) to copy the numeric portion of the file name to another field such as Headline. But now I need a tool that can take the value in Headline (e.g. 1234) and subtract 1 from it after which I can use the "Headline" token in LR's file rename template builder to update the actual file name.

What I'm missing is the tool to do that arithmatic on the Headline tool so if someone can point me to such a thing, I'd be grateful. I though Lightroom Solutions' "search & replace" might do it, but I don't see how to do math in that tool (maybe just looking in wrong place).

Thanks -- Dan
 
You can use the magic LUA token:

Code:
{LUA=return FilenameNumber - 1}

I haven't tested this, so as with all programming, there's a strong likelihood of a bug :->
 
Are you trying to rename a series of files (e.g. IMG1234-IMG1334) to ( IMG1233-IMG1333)? If they are in sequence you can rename from any starting value (i.e.IMG1233) and increment the rest by one.

If you don’t have a long series, it is probably just as easily to renamed the few images manually. If you did this manually, then you would like be done by now.


Sent from my iPad using Tapatalk
 
To compliment Cletus remarks above.

Many people do not realise you can modify an individual filename using the metadata field for "File Name".

Just put your cursor into the section of the existing field name you wish to edit. Do not change the file type.

Very useful for individual file names or a small number of filenames.

I use this regularly to put meaningful filenames on exported images I send to people via email, etc.

1619252777591.png
 
Gnits: Thanks - I am familiar with renaming a single file in the metadata panel as well as using a file rename template,

Cleetus: the images needing the rename are not in an unbroken numeric sequence. There are gaps

John: thanks. I'll take a look at Jeffery's blog and give the LUA code a try.

Thanks all -- Dan
 
Status
Not open for further replies.
Back
Top