Can a null value be allowed in ATTR_REPLACE_STR?

kbelliskbellis Global Mapper UserPosts: 517Trusted 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?

Best Answer

  • bmg_bobbmg_bob Global Mapper Programmer Posts: 1,904
    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

Answers

  • kbelliskbellis Global Mapper User Posts: 517Trusted 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.




Sign In or Register to comment.