Author Topic: Use a variable to insert text in multiple fields  (Read 838 times)

Offline Jeff Vogan

  • Newcomer
  • *
  • Posts: 41
    • View Profile
Use a variable to insert text in multiple fields
« on: March 31, 2025, 08:23:42 AM »
I do a Code Replacement to insert a name in the caption, and then either cut & paste to insert that name into the Headline, Keywords, Persons Shwon or Personality field. It would be faster if I could have a placeholder in those multiple fields and then do one Code Replacement that inserts the text into the multiple fields.  I have recently seen this done in Caption Pro.

In the attached screenshot, Caption Pro has a placeholder, = people, in the Caption field and a few other fields. If you change the contents of = people, it inserts the change into the various fields. That would be a great timesaver.

Offline Max Lemesh

  • Full Member
  • ***
  • Posts: 244
    • View Profile
Re: Use a variable to insert text in multiple fields
« Reply #1 on: March 31, 2025, 09:20:03 AM »
I see Jeff's ideas, I automatically click 'like'

Offline Kevin M. Cox

  • Hero Member
  • *****
  • Posts: 559
  • 2025.1 (8239) | macOS 15.5
    • View Profile
    • Kevin M. Cox | Photojournalist
Re: Use a variable to insert text in multiple fields
« Reply #2 on: May 03, 2025, 07:10:34 PM »
Something to automatically add any names into those other fields would be great.

In my case I'd love it if any code replacement used (e.g. /h27/) would check for the existence of a specific column (e.g. /h27#3/) and insert it into the secondary field like Persons Shown.

This is because in most cases I don't want "Houston Astros second baseman Jose Altuve (27)" to be inserted into the Persons Shown field, I want just their name "Jose Altuve" which is commonly in the third column.

And since non-people replacements like "1i" = "first inning" won't have a third column, they wouldn't get inserted into the secondary field.
Kevin M. Cox | Photojournalist
https://www.instagram.com/kevin.m.cox/

Offline Jeff Vogan

  • Newcomer
  • *
  • Posts: 41
    • View Profile
Re: Use a variable to insert text in multiple fields
« Reply #3 on: May 07, 2025, 07:45:46 PM »
Kevin, the default delimiting character used to be /. It was changed a few years ago when somebody pointed out that when trying to create subfolders on ingest, the / intended to create the subfolder was interpreted as a delimiting character. So the default was changed to =. Why would that be of value? When shooting your baseball game, you could shoot pregame in 100, 1st inning in 101, 2nd inning in 102, etc. When you ingest, create subfolders automatically for each inning. You could use that variable in your caption. It also makes it easier to find that great photo that you took because you know it was taken in the 5th inning. Moving from / to = as the delimiting character opens up so many options for subfolders when ingesting.

Offline Claude Diderich

  • Newcomer
  • *
  • Posts: 48
  • Claude Diderich
    • View Profile
    • Claude Diderich Sports Pictures
Re: Use a variable to insert text in multiple fields
« Reply #4 on: June 13, 2025, 01:55:26 AM »
I am using the following workaround: I am defining the code replacement `people` in a dedicated CR file, e.g., `people.txt`, which I have open in a separate window. Then I edit the code in `people.txt`, rather than in the metadata, reload the captions (I am still using an old version of PM which does not automatically reload CRs), and re-evaluate the fields.

I have gone even further for captioning tennis, `+p1` is the first player, `+p2`, the second player, `+match` the match type, e.g. `first round single men match`, and `d20250526` as `two`, etc.. And then I define my one of caption code replacements as `!c1af  =+p1= plays a forehand against =+p2= during the =+match= on day =+d{iptcdate}= of the {yr4} {event} at {location} on {dow}, {monthname} {day}, {year4} in {city}, {country}`.
Claude Diderich, sports photographer, member of AIPS and sportpress.ch

Offline Kevin M. Cox

  • Hero Member
  • *****
  • Posts: 559
  • 2025.1 (8239) | macOS 15.5
    • View Profile
    • Kevin M. Cox | Photojournalist
Re: Use a variable to insert text in multiple fields
« Reply #5 on: June 14, 2025, 12:39:41 PM »
Kevin, the default delimiting character used to be /. It was changed a few years ago when somebody pointed out that when trying to create subfolders on ingest, the / intended to create the subfolder was interpreted as a delimiting character.

Thanks Jeff, but I've got no desire to change my delimiter character. / is perfect for me when quickly captioning in the middle of games and I've got over a decade of muscle memory using it.

The delimiter character used shouldn't really have an impact on this feature request.
Kevin M. Cox | Photojournalist
https://www.instagram.com/kevin.m.cox/

Offline Claude Diderich

  • Newcomer
  • *
  • Posts: 48
  • Claude Diderich
    • View Profile
    • Claude Diderich Sports Pictures
Re: Use a variable to insert text in multiple fields
« Reply #6 on: Yesterday at 08:04:02 AM »
I see even a more general use case (but don't know what would be the most appropriate solution and how this would be implemented) to have a code replacement in one field trigger an entry in another field. For example, if I enter the code replacement /+x/ in any field, e.g., the caption field (+x would replace to the name and team of a player), this will trigger, the code /x/ (only the name of the player) to be inserted/added into the People field. Similarly, if I insert /D1/ in the caption field it will replace to 'on day one' and add ': Day 1' to the headline field. Another use case would be if I enter /!pb/ in the caption field replacing to 'plays the ball', this would add 'Action' to the IPTC Scene field.

Maybe a specification in the cr.txt file could look something like
Code: [Select]
cr_code => field_name:field_valuewhere entering the code replacement code cr_code in one field will trigger the value field_value to be inserted (added, if it is a list field and not yet in the list) in the field field_name.
e.g.
Code: [Select]
x   Athlete Name Athlete team
+x /x/ of team /x#2/
+x => People:/x/

Just some thoughts :-;
Claude Diderich, sports photographer, member of AIPS and sportpress.ch