Author Topic: Replace text when applying another Metadata Template  (Read 5208 times)

Offline aeschi

  • Newcomer
  • *
  • Posts: 16
    • View Profile
Replace text when applying another Metadata Template
« on: November 02, 2023, 09:26:33 AM »
I have a Metadata (IPTC) Template with various fields, including Description/Caption and Persons shown.

Into the Persons shown field I enter the player number (e.g. =11=) and the code replacement turns it into #11 Paul Meier. Since I have {persons} written into the Description/Caption field (that has also other information in it), #11 Paul Meier is being added to that field when I apply the same Metadata Template again.
I do this because I can then apply different Metadata Templates to the same image for different clients without having to enter the players every time.

Until this point, everything is fine. But now I want to export/save a subset of my images with a different caption to be used for Instagram posts. In this caption I also want to have specific tags etc.
And I want to replace #11 Paul Meier with #11 Paul Meier @paulmeier1, i.e. adding the Instagram handle of the player.

Is this possible? Thank you very much for all ideas and hints!

Offline Mick O (Camera Bits)

  • Camera Bits Staff
  • Hero Member
  • *****
  • Posts: 556
    • View Profile
    • Camera Bits
Re: Replace text when applying another Metadata Template
« Reply #1 on: November 02, 2023, 09:59:47 AM »
There may be other better ideas, but here is one approach if I understand your process:

In your Code Replacement file where you have:

Code: [Select]
11 #11 Paul Meier
You could add another column (separated again by a tab) that includes the IG handle

Code: [Select]
11 #11 Paul Meier #11 Paul Meier (@paulmeier1)
Then, you could have a separate Metadata (IPTC) template where you use the code replacement  =11#2= to replace with that separate column. You can then do a "Copy" (cmd-y on macOS, ctrl-y on Win) operation on those files that need the special caption and apply that second template during the copy.

Would this do what you need?

-Mick

More about Code Replacements here:
https://camerabits.freshdesk.com/support/solutions/articles/48000223660-introduction-to-code-replacements-in-photo-mechanic


Mick O
Camera Bits

Offline aeschi

  • Newcomer
  • *
  • Posts: 16
    • View Profile
Re: Replace text when applying another Metadata Template
« Reply #2 on: November 02, 2023, 10:13:39 AM »
Thank you very much, Mick.

I thought about this already, but then I have to add =11= for every image again. I only want to enter =11= once for every image.
A search&replace function would be nice... ;)

Offline ahoward

  • Camera Bits Staff
  • Hero Member
  • *****
  • Posts: 991
    • View Profile
Re: Replace text when applying another Metadata Template
« Reply #3 on: November 02, 2023, 10:18:39 AM »
Thank you very much, Mick.

I thought about this already, but then I have to add =11= for every image again. I only want to enter =11= once for every image.
A search&replace function would be nice... ;)
It sounds like you are looking for 'Find and Replace' which is available in the Edit menu?

Offline aeschi

  • Newcomer
  • *
  • Posts: 16
    • View Profile
Re: Replace text when applying another Metadata Template
« Reply #4 on: November 02, 2023, 10:26:53 AM »
Yes, but I have to search & replace for different players, not only for one.

It's possible to use code replacements for languages, e.g. month names (March -> März). I thought about this, but it did not work.

Offline Mick O (Camera Bits)

  • Camera Bits Staff
  • Hero Member
  • *****
  • Posts: 556
    • View Profile
    • Camera Bits
Re: Replace text when applying another Metadata Template
« Reply #5 on: November 02, 2023, 10:53:11 AM »
So if I understand you correctly, you have a Metadata Template where you type =11= into the Persons Shown field, and then you use the {persons} variable elsewhere to insert that name in other places? If so, you could use Hot Codes to also insert an IG handle. If your Code Replacement sheet had a section like this...

Code: [Select]
// Code Replacement file with Hot Codes for Photo Mechanic
// Enter the variables you will be looking for strings in
//== {persons}
// Name your hotcodes here
//## ighandle
#11 Paul Meier @paulmeier1
#27 Mick Orlosky @redfishingboat
#99 Wayne Gretzky @waynegretzky
//??



You could apply a Metadata Template with a caption of "This is a photo of {persons} [ighandle]"

For a photo where "#11 Paul Meier" is in Persons Shown, then [ighandle] will be replaced with @paulmeier1, but the same template applied to a photo where "#99 Wayne Gretzky" is in Persons Shown, then [ighandle] would be replaced with @waynegretzky etc.   And if the Persons Shown field is empty, then {persons} & [ighandle] would both be replaced with nothing.

Is this closer to what you're looking for? (I attached the file also)

-Mick

More about Hot Codes is here:
https://camerabits.freshdesk.com/support/solutions/articles/48000358684-hot-codes


Mick O
Camera Bits

Offline aeschi

  • Newcomer
  • *
  • Posts: 16
    • View Profile
Re: Replace text when applying another Metadata Template
« Reply #6 on: November 02, 2023, 11:17:56 AM »
Thank you very much! This is definitely closer to what I'm looking for. It works fine with one player in the Persons field.
As soon as I have more players in the field or a sentence like "#99 Wayne Gretzky scores his first goal in this game." it doesn't work.

Offline Max Lemesh

  • Full Member
  • ***
  • Posts: 173
    • View Profile
Re: Replace text when applying another Metadata Template
« Reply #7 on: November 09, 2023, 05:38:15 AM »
That's quite interesting use case. Thank you guys for this