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

Apply Object Style for Anchor

Enthusiast ,
Jul 17, 2013 Jul 17, 2013

Copy link to clipboard

Copied

Hi All,

Could anyone please give solution for my request.

1. Find Anchor marker

2. Apply object style for that selecting parent Graphics frame.

var myDoc = app.activeDocument;

app.findGrepPreferences = app.changeGrepPreferences = null;

app.findGrepPreferences.appliedParagraphStyle = "abc"

app.findGrepPreferences.findWhat = "~a"

var myFound = myDoc.findGrep();

for(i=0; i<myFound.length; i++)

{

    myFound.parentTextFrames[0].appliedObjectStyle = app.activeDocument.objectStyles.item("Image")   //Error this only

    }

Thanks in advance

Beginner

TOPICS
Scripting

Views

587

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

Contributor , Jul 17, 2013 Jul 17, 2013

Hi

An anchored object is not parent but child(pageItem) for anchor.

myFound.parentTextFrames[0].appliedObjectStyle = app.activeDocument.objectStyles.item("Image")   //Error this only

try this code

myFound.pageItems[0].appliedObjectStyle = app.activeDocument.objectStyles.item("Image");

thankyou

mg.

Votes

Translate

Translate
Contributor ,
Jul 17, 2013 Jul 17, 2013

Copy link to clipboard

Copied

LATEST

Hi

An anchored object is not parent but child(pageItem) for anchor.

myFound.parentTextFrames[0].appliedObjectStyle = app.activeDocument.objectStyles.item("Image")   //Error this only

try this code

myFound.pageItems[0].appliedObjectStyle = app.activeDocument.objectStyles.item("Image");

thankyou

mg.

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