• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

[JS CS3] Find/Change "[Basic Paragraph]" style

Participant ,
Mar 11, 2008 Mar 11, 2008

Copy link to clipboard

Copied

I'm trying to find all occurances of the [Basic Paragraph] style and replace them with [No Paragraph Style]. I'm using:

app.findTextPreferences.appliedParagraphStyle = "[Basic Paragraph Style]";
app.changeTextPreferences.appliedParagraphStyle = "[No Paragraph Style]";

I get the message "Invalid value for set property 'appliedParagraphStyle'. Expected String, ParagraphStyle or NothingEnum enumerator, but received "[Basic Paragraph Style]"."

I've tried every combination of brackets, no brackets, quotes, no quotes, etc. It doesn't seem like this can be scripted, even though it can be done via find/change in InDesign. Am I banging my head against the wall? Does anyone know if this can be done?
TOPICS
Scripting

Views

1.8K

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 ,
Mar 11, 2008 Mar 11, 2008

Copy link to clipboard

Copied

"[Basic Paragraph]" as shown in the code below doesn't work either. (the word "Style" actually snuck in as I was trying different variations. But no combination seems to work.

If anyone knows that [Basic Paragraph] can or cannot be accessed via scripting, I'd like to know. Thanks.

app.findTextPreferences.appliedParagraphStyle = "[Basic Paragraph]";
app.changeTextPreferences.appliedParagraphStyle = "[No Paragraph Style]";

Votes

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
Enthusiast ,
Mar 11, 2008 Mar 11, 2008

Copy link to clipboard

Copied

Leave out the word "style" in Basic Paragraph Style. It should just say
"[Basic Paragraph]".

Votes

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 Expert ,
Mar 11, 2008 Mar 11, 2008

Copy link to clipboard

Copied

Keith,

You need this format:

app.findTextPreferences.appliedParagraphStyle =
app.activeDocument.paragraphStyles.item("[Basic Paragraph]")

For those two styles.

Peter

Votes

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
Explorer ,
Mar 11, 2019 Mar 11, 2019

Copy link to clipboard

Copied

What if I don't want to change the style I just want to find the basic paragraph style and then alert the user?

like:

if

(app.findTextPreferences.appliedParagraphStyle ==

app.activeDocument.paragraphStyles.item("[Basic Paragraph]") )

{ alert "you have basic paragraphs");}

Votes

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 Expert ,
Mar 11, 2019 Mar 11, 2019

Copy link to clipboard

Copied

LATEST

Try the following

app.findTextPreferences.appliedParagraphStyle = app.activeDocument.paragraphStyles.itemByName("$ID/[Basic Paragraph]")

var res = app.documents[0].findText()

if(res.length != 0)

    alert("You have basic paragraphs")

-Manan

Votes

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 ,
Mar 11, 2008 Mar 11, 2008

Copy link to clipboard

Copied

Peter, thanks. Works like a charm!

Votes

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