EZ-Script Bugs

Trailing backslash in string

If the last character of a string literal is a backslash (\), EZ-Script will produce a parser error. This most commonly occurs when you concatenate variables to create file paths: the final backslash is interpreted as escaping the closing quote, which leaves the string unterminated.

Why this happens

The parser treats the trailing backslash as an escape character for the quote that marks the end of the string. As a result, the string is not closed correctly and an error is thrown.

Example that produces an error

# This will produce an error
$x = "C:\temp\"
$y = $x + "asdf"
print($y)

Workaround and correct approach

To avoid the error, do not end a literal with a backslash. Place the backslash at the start of the next literal or add it as its own separate literal when concatenating.

# This is successful
$x = "C:\temp"
$y = $x + "\asdf"
print($y)

Recommendations

  • Avoid leaving a trailing backslash in a string literal; include the separator at the start of the appended string or as a separate literal.
  • When modifying or testing existing EZ-Scripts that build paths, check for trailing backslashes that could trigger this bug.
  • For new scripts, prefer JavaScript or Python in ARC. They are actively maintained and have well-defined escaping and string behavior.