Copy link to clipboard
Copied
Hello! 🙂
I've been trying to create a grep expression to use in "FindChangeByList".
Just to explain. I've a book with several texts and titles.
The titles usually start with:
1 Title Here
Then the text comes next.
I want to find all sentences that start with a number e use in it a paragraph style that is inside one folder. How can I do that?
I've tried the following:
grep {findWhat:"^\\d"} {appliedParagraphStyle:app.activeDocument.paragraphStyleGroups.item(“TÍTULOS”).paragraphStyles.item(“título 2”)} {includeFootnotes:false, includeMasterPages:false, includeHiddenLayers:false, includeLockedLayersForFind:false}
But it doesn't work. 😞
Does some know how to solve it?
Thanks in advance.
Thank you so much, Manan! 🙂
It didn't work the way you had said there, but I just made a small change at the script and now this is working perfectly.
Just in case someone else needs, this is how it's working for me:
grep {fontStyle:"Italic"} {appliedParagraphStyle:app.doScript('function getStyle() { var ps = app.activeDocument.allParagraphStyles; for(var i = 0; i < ps.length; i++) { if( ps[i].name == "Italic" ) { return ps[i]; } } } getStyle();', ScriptLanguage.javascript)} {includeFootnotes:tr
...
Copy link to clipboard
Copied
Hi Maiane,
Have a look at the following thread where i have posted an example of how to use styles within folder with FindChangeByListScript
-Manan
Copy link to clipboard
Copied
Thank you so much, Manan! 🙂
It didn't work the way you had said there, but I just made a small change at the script and now this is working perfectly.
Just in case someone else needs, this is how it's working for me:
grep {fontStyle:"Italic"} {appliedParagraphStyle:app.doScript('function getStyle() { var ps = app.activeDocument.allParagraphStyles; for(var i = 0; i < ps.length; i++) { if( ps[i].name == "Italic" ) { return ps[i]; } } } getStyle();', ScriptLanguage.javascript)} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}
By the way, I didn't know we could include javascript inside this text file. I loved it! 😄
Copy link to clipboard
Copied
Hi Maiane,
Thanks for pointing that the code in my reply did not work, i have edited it. When we migrated from the old forum software to the new software, the code migration in threads was not perfect and things got wrongly ported to the new platform. Not my fault 🙂
-Manan