0

I am getting extra spaces and early line break on the indesign file. Indesign file is generated programmatically using Javascript. I was trying following script but nothing changed on indesign file.

app.findTextPreferences.findWhat="^\s?(.)";
app.changeTextPreferences.changeTo="$1";

Your assistance in this matter would be greatly appreciated.

Urbi
  • 125
  • 1
  • 4
  • 18

1 Answers1

0

you should escape backslash in findWhat expression.

//@target "indesign"
app.findGrepPreferences            = NothingEnum.nothing;
app.changeGrepPreferences          = NothingEnum.nothing;
app.findGrepPreferences.findWhat   = "^\\s?(.)"; // -> this line
app.changeGrepPreferences.changeTo = "$1";
app.documents[0].changeGrep();

this snippet will works.

thank you. mg

milligramme
  • 404
  • 3
  • 9