Highlighted

How to check if a flow contains a particular paragraph style?

New Here ,
Jun 16, 2017

Copy link to clipboard

Copied

The script iterates through a doc and works on changing conditional tags in it but it does not factor in whether the paragraph style is "Anchor" i.e. whether it contains an Anchored Frame or not. How can I use the flow object to check if the paragraph style is "Anchor" or if the paragraph contains an Anchored Frame or not?

Working code is

var flow = active.FirstFlowInDoc

        while(flow.ObjectValid())

        {

            // need an if condition here before calling the changeCondTagInPgf function

                 changeCondTagInPgf(flow,active)

            flow = flow.NextFlowInDoc

        }

The script should only call the ChangeCondTagInFlow() function if the paragraph style is "Anchor" or if it is/contains an Anchored Frame.

Adobe Community Professional
Correct answer by frameexpert | Adobe Community Professional

This post has the test to see if the paragraph contains an anchored frame:

How to check if a paragraph is/contains an anchored frame or not? if it is/does, apply/remove conditional tags on it?

You should be looping through paragraphs, not flows. To test for the Anchor paragraph format, you can use this:

if (pgf.Name === "Anchor") {

    // Do something here.

}

You can combine this with the function in the other post:

if ((pgf.Name === "Anchor") || (hasAnchoredFrame (pgf)) {

    // Do something here.

}

TOPICS
Scripting

Views

195

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

How to check if a flow contains a particular paragraph style?

New Here ,
Jun 16, 2017

Copy link to clipboard

Copied

The script iterates through a doc and works on changing conditional tags in it but it does not factor in whether the paragraph style is "Anchor" i.e. whether it contains an Anchored Frame or not. How can I use the flow object to check if the paragraph style is "Anchor" or if the paragraph contains an Anchored Frame or not?

Working code is

var flow = active.FirstFlowInDoc

        while(flow.ObjectValid())

        {

            // need an if condition here before calling the changeCondTagInPgf function

                 changeCondTagInPgf(flow,active)

            flow = flow.NextFlowInDoc

        }

The script should only call the ChangeCondTagInFlow() function if the paragraph style is "Anchor" or if it is/contains an Anchored Frame.

Adobe Community Professional
Correct answer by frameexpert | Adobe Community Professional

This post has the test to see if the paragraph contains an anchored frame:

How to check if a paragraph is/contains an anchored frame or not? if it is/does, apply/remove conditional tags on it?

You should be looping through paragraphs, not flows. To test for the Anchor paragraph format, you can use this:

if (pgf.Name === "Anchor") {

    // Do something here.

}

You can combine this with the function in the other post:

if ((pgf.Name === "Anchor") || (hasAnchoredFrame (pgf)) {

    // Do something here.

}

TOPICS
Scripting

Views

196

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
Jun 16, 2017 0
Adobe Community Professional ,
Jun 16, 2017

Copy link to clipboard

Copied

This post has the test to see if the paragraph contains an anchored frame:

How to check if a paragraph is/contains an anchored frame or not? if it is/does, apply/remove condit...

You should be looping through paragraphs, not flows. To test for the Anchor paragraph format, you can use this:

if (pgf.Name === "Anchor") {

    // Do something here.

}

You can combine this with the function in the other post:

if ((pgf.Name === "Anchor") || (hasAnchoredFrame (pgf)) {

    // Do something here.

}

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
Reply
Loading...
Jun 16, 2017 0
New Here ,
Jun 16, 2017

Copy link to clipboard

Copied

Can I access paragraphs from within flows?

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
Reply
Loading...
Jun 16, 2017 0
Adobe Community Professional ,
Jun 16, 2017

Copy link to clipboard

Copied

pgf = flow.FirstTextFrameInFlow.FirstPgf;

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
Reply
Loading...
Jun 16, 2017 0
New Here ,
Jun 21, 2017

Copy link to clipboard

Copied

Hi Rick, The script appears to work correctly now, but I am receiving the following error in the FrameMaker console: Graphic file can not be replaced with Text file. I have used your frameautomation tutorial as a reference to change conditional tag applied on paragraph. Can you please explain what am I missing?

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
Reply
Loading...
Jun 21, 2017 0