Global Mapper v25.0

Can a null value be allowed in ATTR_REPLACE_STR?

kbellis
kbellis Global Mapper UserTrusted User
Apparently, a null value isn't acceptable in this example of ATTR_REPLACE_STR



In the GUI's Search and Replace action, null values work, but not in this scripting scenario. Still, I wonder, can a null value somehow be allowed?

Answers

  • bmg_bob
    bmg_bob Global Mapper Programmer
    Answer ✓
    Hello,

    Your parameter
    ATTR_REPLACE_STR=".JPG=" 
    is incorrect. It needs to contain three pieces of information, separated by equal signs: the attribute name, the string value to replace, and the new string value. This is what the error message is referring to. Assuming your attribute is FILE_NAME, the correct syntax is:
    ATTR_REPACE_STR="FILE_NAME=.JPG="
    I think this syntax will replace ".JPG" with an empty string.

    Cheers,
    Bob
  • kbellis
    kbellis Global Mapper User Trusted User
    bmg_bob said:
    Hello,

    Your parameter
    ATTR_REPLACE_STR=".JPG=" 
    is incorrect. It needs to contain three pieces of information, separated by equal signs: the attribute name, the string value to replace, and the new string value. This is what the error message is referring to. Assuming your attribute is FILE_NAME, the correct syntax is:
    ATTR_REPACE_STR="FILE_NAME=.JPG="
    I think this syntax will replace ".JPG" with an empty string.

    Cheers,
    Bob
    Yes! You've got it! - except in this instance, to be precise, it's actually ATTR_REPLACE_STR="NAME=.JPG=" , and not FILE_NAME

    One nuance on this worth noting; because the .JPG falls at the end of the string, this worked fine; however, using ATTR_REPLACE_STR="NAME=DJI_0=" to strip the front end bits of text, results in the a null value for the attribute NAME, thus why I added back the 0

    Thank you for your help and clear explanation.