Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


Apply conditional text in a certain paragraph style

Participant ,
Jun 21, 2018 Jun 21, 2018

Copy link to clipboard

Copied

How are friends, could anyone tell me how I could apply conditional text "TEACHER" only in a particular paragraph style? Thanks for the help, thank you.

TOPICS
Scripting

Views

656

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 , Jun 21, 2018 Jun 21, 2018
Hello there,               Try this below code.applyCondition();function applyCondition(){    var myParaStyle = 'TEACHER';    app.findTextPreferences.appliedParagraphStyle = myParaStyle;    var found = app.documents[0].findText();    var c = 0;    while(c < found.length){        found.paragraphs.everyItem().appliedConditions = app.documents[0].conditions.item('TEACHER');        c++;        }    }

Likes

Translate

Translate
Adobe Community Professional ,
Jun 21, 2018 Jun 21, 2018

Copy link to clipboard

Copied

Hello there,

               Try this below code.

applyCondition();

function applyCondition(){

    var myParaStyle = 'TEACHER';

    app.findTextPreferences.appliedParagraphStyle = myParaStyle;

    var found = app.documents[0].findText();

    var c = 0;

    while(c < found.length){

        found.paragraphs.everyItem().appliedConditions = app.documents[0].conditions.item('TEACHER');

        c++;

        }

    }

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
Participant ,
Jun 21, 2018 Jun 21, 2018

Copy link to clipboard

Copied

Thanks my friend. Perfect.

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 ,
Jul 23, 2021 Jul 23, 2021

Copy link to clipboard

Copied

Hi... so I tried this... it's .jsx right? I changed the 'Teacher' to my corresponding paragraph style and it didn't work. Bit lost as to how this works.

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
Advisor ,
Jul 24, 2021 Jul 24, 2021

Copy link to clipboard

Copied

LATEST

For readers, if not included in a more complete process, no need a script for such a simple work! A simple F/R will be enough.

 

(^/)  The Jedi

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