Why is CRLF treated differently when called via bridgetalk?
I bumped into yet another mystery: When I run a script directly in ExtendScript, it interpretes the '\r' as a CRLF. Yet, when I called it via bridgetalk, the '\r' was left as text.
This strange behavior exists if I set target to photoshop or not. Can someone tell me why please?
Below is the unit test (CS6, Windows 10)
- Calling script:
#target bridge
var bt = new BridgeTalk;
bt.target = 'photoshop';
var myPath = '~/Desktop/testCarriageReturnSubstitution.jsx';
var scriptFile = new File(myPath);
var fOpen = scriptFile.open('r');
var script = scriptFile.read();
$.writeln(script);
bt.body =script;
bt.send();
- Test script:
#target photoshop
var badString = '\rTitle\rCity, State - USA December 2015';
var newString = badString.replace('\n', "\n");
$.writeln (badString);
$.writeln(newString);
Result when running directly via ExtendScript:
Title
City, State - USA December 2015
Result: undefined
Result when invoked via calling script:
Result: true
\rTitle\rCity, State - USA December 2015
Thanks,
/Tim
