Copy link to clipboard
Copied
I'm trying to find text between to "Start" and "End" strings and change the selected text Character Style.
I can run the following Find/Change in InDesign and it works as expected:
Find What: (?s)(?<=Begin--FBC--Amway Top 25 Poll).*?(?=End--FBC--Amway Top 25 Poll)
Change format: Paragraph Style: FBC-Top 25
But when I use the following text in the FindChangeList.txt file (running FindChangeByList.jsx) I get a syntax error, I'm not sure if it's the grep syntax in the FindWhat parameter or the changeTo syntax.
grep {findWhat:”(?s)(?<=Begin--FBC--Amway Top 25 Poll).*?(?=End--FBC--Amway Top 25 Poll)”} {appliedParagraphStyle:”FBC-Top 25”} {includeFootnotes:false, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}
I have also tried:
grep {findWhat:”(?s)(?<=Begin--FBC--Amway Top 25 Poll).*?(?=End--FBC--Amway Top 25 Poll)”} {changeTo:”$0”,appliedParagraphStyle:”FBC-Top 25”} {includeFootnotes:false, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}
I'm beginning to think it has something to do with the way the findWhat: is formatted but I'm not a Grep expert and I don't know what to change it to.
Any help would be greatly appreciated.
Steve
PS The FindChangeList.txt parameters in the original txt file are tab separated
Copy link to clipboard
Copied
Hi,
Remove "wholeWord:false" part since this not a findChangeGrepOptions property
Jarek
Copy link to clipboard
Copied
Still getting a syntax error, even with the correct findChangeGrepOptions.
I get "syntax error column 1" when it executes this line: app.doScript(myString, ScriptLanguage.javascript);
myString has this value:
app.findGrepPreferences.properties = {findWhat:”(?s)(?<=Begin--FBC--Amway Top 25 Poll).*?(?=End--FBC--Amway Top 25 Poll)”};app.changeGrepPreferences.properties = {appliedParagraphStyle:”FBC-Top 25”};app.findChangeGrepOptions.properties = {includeFootnotes:false, includeMasterPages:true, includeHiddenLayers:true};
Is the GREP command causing the error?
Unfortunately the ExtendScript Toolkit gives me on other information except "Syntax Error".
Copy link to clipboard
Copied
Hi frengold,
start with the original demo script and copy a line from the FindChangeList.txt and insert your values.
Is is working ?
It may have to do with tabs in the txt file.
thanks Stefan
Copy link to clipboard
Copied
I changed the first line in the original FindChangeList.txt file and replaced the parameters with my parameters (leaving the tabs intact), I still get a syntax error on this line:
grep | {findWhat:”(?s)(?<=Begin--FBC--Amway Top 25 Poll).*?(?=End--FBC--Amway Top 25 Poll)”} | {changeTo:"appliedParagraphStyle:”FBC-Top 25”"} | {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} | Find and apply style. |
I didn't change anything except the information between the quotes for each option (the third parameter is exactly as it is in the original). Still a syntax error.
The remaining 7 lines in the original txt file execute without problems.
I still think it has something to do with the GREP findWhat parameter needing to be structured differently in the txt file than is is when I run it from the Find/Change menu option.
Thanks for your help.
Steve