Find/Change by list find to specific style in folder

Community Beginner ,
Feb 08, 2022 Feb 08, 2022

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

 

TOPICS
How to , Scripting

Views

77

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Community Professional , Feb 08, 2022 Feb 08, 2022
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(...

Likes

Translate

Translate
Adobe Community Professional ,
Feb 08, 2022 Feb 08, 2022

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

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 08, 2022 Feb 08, 2022

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

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 08, 2022 Feb 08, 2022

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

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Feb 08, 2022 Feb 08, 2022

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

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 09, 2022 Feb 09, 2022

Copy link to clipboard

Copied

LATEST

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

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines