Skip to main content
Inspiring
November 26, 2024
Answered

New Script: Text Substitutions/Code Replacements

  • November 26, 2024
  • 2 replies
  • 858 views

Hi all!

 

I wanted to share a script I've been working on - Text Substitutions! Inspired by PhotoMechanic's Code Replacements feature, this lets you add substitution [[targets]] to your metadata, and then have them replaced by any kind of text! About 50 substitutions are built in - letting you quickly swap in other metadata fields like the creation time, credit line, and location - and you can also create your own substitutions.

 

You can find the script on Adobe Exchange for $5/month, or for free in my bridge-scripts github repo (the two versions are identical). Detailed information about how to use the program and its various features can be found on the wiki.

 

This is still in development and it's based on my workflow, so if anyone has any suggestions I'd be happy to hear them out!

Correct answer dashz63429591

Update - Version 1.2 & 1.2.1, Aug 2025

Medium-sized update for Text Substitutions with new functional & builtin substitutions, as well as QoL updates for editing substitution files. Download on GitHub!

 

Major Changes:

  • Added new fuctional substitutions:
    • fLength, fLen
    • fGetIndex, fIndex, fIndexOf
    • fGetLastIndex. fLastIndex, fLastIndexOf
    • fFindReplace, fReplace
    • fToUpperCase, fToUpper
    • fToLowerCase, fToLower
    • fToTitleCase, fToTitle
    • fAnyEquals, fAnyEq
  • Added new builtin substitutions:
    • mDescription, mDesc
    • tDOW, tDayOfWeek (aliases for tDayP)
  • Changes to already-loaded custom substitution files are now detected and automatically reloaded when the script is run - no more need to open the settings and click the reload button!
  • Added support for multi-line substitution definitions - in a custom substitution file, ending a substitution definition with a backslash (\) will ignore the following newline and continue reading the substitution definition on the next line.
    • Leading tabs on the following line will be ignored.
    • If the following line is commented out or only contains tabs, it will be ignored and the next line will be used.
  • New substitution file - ts_usefulSubstitutions.txt containing some useful custom substitutions for advanced work (for detecting plurals and leading vowels)

 

Minor Changes

  • Update the Photo Mechanic Variables custom substitutions file with the new substitutions.
  • Cosmetic changes to the settings panel
  • (1.2.1) fToTitleCase now makes the whole string lowercase before proceeding.

 

Download on GitHub or from Adobe Exchange (will likely take a few days for the update to get approved).

2 replies

Stephen Marsh
Community Expert
Community Expert
December 3, 2024

@dashz63429591 

 

Thank you for sharing, keep up the great work!

Inspiring
November 29, 2024

Update:

- Fixed a bug where built-in substitutions that printed the name of the month would be off by a month.

Re-download the script and install as normal!

Inspiring
December 2, 2024

Update:

- Built-in substitutions that grab the date now grab it from the EXIF DateTimeOriginal field rather than the XMP DateCreated field. The EXIF field is the one that gets edited by the "Edit Capture Time" feature.

- Removed some debugging code that could pop up unnecessary alerts when using recursive substitutions.