musabio
06-18-2008, 06:58 PM
I'm a little confused about the proper syntax/techniques for dealing with special string characters, particularly quotes.
I see that Setup Builder automatically quotes certain strings, like %_SB_INSTALLDIR%. But if you manipulate such a string, such as with one of the the Handle Strings "split" functions, you end up with a pair of strings that have mismatched quotes. For example, this function:
Set Variable %PART1% and %PART2% to FUNCTION:Split Source String at First Occurrence of Search String(%SOME_PATH%, "\")
results in %PART1% having a leading quote and %PART2% having a trailing quote.
Appending a new filename to the directory in the first part doesn't automatically fix the mis-matched quotes, and trying to use such a file spec to reference an actual file doesn't work.
To re-balance the quotes, I tried using the Set Variable function with the append option, but it isn't clear: A) what the proper syntax for specifying a string consisting of one double-quote character is, or B) whether the Set Variable with append strips recognizes a single quote. It does seem you can enter the single character " as the value to be assigned to a string in the Set Variable function, but it doesn't appear to work when appending.
Eventually, I managed to work around the problem by using the Mid function to remove the un-matched quote at the front, but it seems like a circuitous roundabout for what seems like a common operation in installers.
I couldn't find any reference in the help file to escaping special characters (e.g. "\042", "%x22", "\q", """, """", etc.), or other guidelines for dealing with partial directory specs resulting from splitting a larger path, so any suggestions or clarifications would be most appreciated.
I see that Setup Builder automatically quotes certain strings, like %_SB_INSTALLDIR%. But if you manipulate such a string, such as with one of the the Handle Strings "split" functions, you end up with a pair of strings that have mismatched quotes. For example, this function:
Set Variable %PART1% and %PART2% to FUNCTION:Split Source String at First Occurrence of Search String(%SOME_PATH%, "\")
results in %PART1% having a leading quote and %PART2% having a trailing quote.
Appending a new filename to the directory in the first part doesn't automatically fix the mis-matched quotes, and trying to use such a file spec to reference an actual file doesn't work.
To re-balance the quotes, I tried using the Set Variable function with the append option, but it isn't clear: A) what the proper syntax for specifying a string consisting of one double-quote character is, or B) whether the Set Variable with append strips recognizes a single quote. It does seem you can enter the single character " as the value to be assigned to a string in the Set Variable function, but it doesn't appear to work when appending.
Eventually, I managed to work around the problem by using the Mid function to remove the un-matched quote at the front, but it seems like a circuitous roundabout for what seems like a common operation in installers.
I couldn't find any reference in the help file to escaping special characters (e.g. "\042", "%x22", "\q", """, """", etc.), or other guidelines for dealing with partial directory specs resulting from splitting a larger path, so any suggestions or clarifications would be most appreciated.