Copy link to clipboard
Copied
Actually been using a solution to replace paragprah styles regardeless of where they were in the folders... which is great but we are compiling a lot of messy styles and we have instances of the same named paragraph styles but in different folders (which have different attributes) so we need to target each style to replace each with a specific style.
With me so far?
grep {findWhat:".", appliedParagraphStyle:app.activeDocument.paragraphStyleGroups.item(āHeadersā). paragraphStyles.item(ā1.3 Article_Headerā) {changeTo:"$0", appliedParagraphStyle:app.doScript('function getStyle(){var ps = app.activeDocument.allParagraphStyles;for(var i = 0; i < ps.length; i++){if( ps[i].name == "2.1 Body Heading") return ps[i]}}getStyle()', ScriptLanguage.javascript)} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}
This is where I'm at and it's test styles from a file.
So to reiterate i'm trying to target a specific paragraph style within a folder and replace it with a new/updated style.
We will be chaining a bunch of these withing the find change text file as we have a number of files to fix up.
Thanks
Copy link to clipboard
Copied
So you are trying to find pstyle named 1.3 Article_Header inside the group Headers and trying to replace it with a style named 2.1 Body Heading? What happens with this string?
-Manan
Copy link to clipboard
Copied
Currently... it just does nothing. I don't get an error message so assuming it's just not doing anything
Copy link to clipboard
Copied
And Yes I will be changing the names and folders... but yeah i'm looking for 1.3 within that folder and replacing it with a style from another folder
Copy link to clipboard
Copied
Try the following. Do take care of the tab character to be used as the seperator and also you had used wrong double quote character at multiple places that took a lot of time to figure out
grep {findWhat:".", appliedParagraphStyle:app.doScript('app.activeDocument.paragraphStyleGroups.item("Headers").paragraphStyles.item("1.3 Article_Header")',ScriptLanguage.javascript)} {changeTo:"$0", appliedParagraphStyle:app.doScript('function getStyle(){var ps = app.activeDocument.allParagraphStyles;for(var i = 0; i < ps.length; i++){if( ps[i].name == "2.1 Body Heading") return ps[i]}}getStyle()', ScriptLanguage.javascript)} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}
-Manan
Copy link to clipboard
Copied
Once you see it! I've been copying and pasting bits from the web so i'm guessing that's how it creeped in.
Very much appreciate the effort