Author Topic: Add keywords when entering code replacements in IPTC caption  (Read 5382 times)

Offline GrahamWilson

  • Newcomer
  • *
  • Posts: 4
    • View Profile
Add keywords when entering code replacements in IPTC caption
« on: November 03, 2013, 12:49:40 AM »
Hi

I was thinking about how things could be sped up a bit when captioning yesterday, and one repetitive task is adding players names to captions and keywords. 

Is it possible - and I appreciate it may not be as they are different fields - but if you were to enter a replacement with a suffix (something like /player1/k) into the caption field, PM would add that code replacement to the keywords field as well, or perhaps /player1/kp would add it to the Keywords and Persons Featured fields?

Out of interest, can code replacements be accessed from variables? 

For example, I always use the same code for home and visiting teams and these are almost always in several places on the IPTC pad.  I have a standard pad permanently set up which uses variables, but if code replacements could be accessed via variables as well (e.g. {"code"} then that would save a bit of time too. 

For example, I could just permanently leave the "organisations featured" field as {"/hometeam/"} {"/visitingteam/"} and know that my pre-match code replacement file has taken care of everything.


Graham.

Offline GrahamWilson

  • Newcomer
  • *
  • Posts: 4
    • View Profile
Re: Add keywords when entering code replacements in IPTC caption
« Reply #1 on: November 03, 2013, 03:55:40 AM »
Following on from this, another time-saver might be chaining replacements.

For example instead of writing /p1/ /g/ /home/ hich gives "Player 1 scores a goal for Teamname", it would be easier to type /p1 g home/ with a space separating the different codes.  Would also make it a bit more intuitive when building longer captions based just on replacements.

It would also cut down on the number of combinations needed in the replacement files.

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 24756
    • View Profile
    • Camera Bits, Inc.
Re: Add keywords when entering code replacements in IPTC caption
« Reply #2 on: November 03, 2013, 06:00:41 AM »
I was thinking about how things could be sped up a bit when captioning yesterday, and one repetitive task is adding players names to captions and keywords. 

Is it possible - and I appreciate it may not be as they are different fields - but if you were to enter a replacement with a suffix (something like /player1/k) into the caption field, PM would add that code replacement to the keywords field as well, or perhaps /player1/kp would add it to the Keywords and Persons Featured fields?

No, it's not possible.  Code Replacement knows nothing specific about the field that it is working in, nor does it know anything about the structure of other "nearby" fields.

Out of interest, can code replacements be accessed from variables?

Yes.  You can in fact have the replacement of a code be a variable which can then itself be a code whose value is another variable.  This recursive nature is evaluated up to ten levels deep.  Deeper than that and PM stops evaluating, thinking that you may have a loop in your definitions that will go on forever.

For example, I always use the same code for home and visiting teams and these are almost always in several places on the IPTC pad.  I have a standard pad permanently set up which uses variables, but if code replacements could be accessed via variables as well (e.g. {"code"} then that would save a bit of time too. 

For example, I could just permanently leave the "organisations featured" field as {"/hometeam/"} {"/visitingteam/"} and know that my pre-match code replacement file has taken care of everything.

Indeed you could, yes.

-Kirk

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 24756
    • View Profile
    • Camera Bits, Inc.
Re: Add keywords when entering code replacements in IPTC caption
« Reply #3 on: November 03, 2013, 06:09:52 AM »
Following on from this, another time-saver might be chaining replacements.

For example instead of writing /p1/ /g/ /home/ hich gives "Player 1 scores a goal for Teamname", it would be easier to type /p1 g home/ with a space separating the different codes.  Would also make it a bit more intuitive when building longer captions based just on replacements.

It would also cut down on the number of combinations needed in the replacement files.

We can't do that.  Each code is itself a single definition.  You can make a code that does have spaces in it if you like, but "p1 g home" would be a single code, and not three individual codes.

-Kirk

Offline Kevin M. Cox

  • Hero Member
  • *****
  • Posts: 511
  • PM 6 (7102) | macOS 14.4.1
    • View Profile
    • Kevin M. Cox | Photojournalist
Re: Add keywords when entering code replacements in IPTC caption
« Reply #4 on: November 03, 2013, 11:33:33 AM »
Following on from this, another time-saver might be chaining replacements.

For example instead of writing /p1/ /g/ /home/ hich gives "Player 1 scores a goal for Teamname", it would be easier to type /p1 g home/ with a space separating the different codes.  Would also make it a bit more intuitive when building longer captions based just on replacements.

It would also cut down on the number of combinations needed in the replacement files.

Could you create two different codes, like: /gh/ and /gv/ that would then map to:
"scores a goal for /home/" and "scores a goal for /visitor/"

Would this work Kirk?
Kevin M. Cox | Photojournalist
https://www.instagram.com/kevin.m.cox/

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 24756
    • View Profile
    • Camera Bits, Inc.
Re: Add keywords when entering code replacements in IPTC caption
« Reply #5 on: November 03, 2013, 02:12:31 PM »
Kevin,

Following on from this, another time-saver might be chaining replacements.

For example instead of writing /p1/ /g/ /home/ hich gives "Player 1 scores a goal for Teamname", it would be easier to type /p1 g home/ with a space separating the different codes.  Would also make it a bit more intuitive when building longer captions based just on replacements.

It would also cut down on the number of combinations needed in the replacement files.

Could you create two different codes, like: /gh/ and /gv/ that would then map to:
"scores a goal for /home/" and "scores a goal for /visitor/"

Would this work Kirk?

Yes, recursive definitions like that are fine, up to 10 levels deep.

-Kirk