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

Is there anyway we could search and replace Grouped Anchor Object in a Cell?

Explorer ,
May 22, 2019 May 22, 2019

Let's assume, i have this grouped anchor object(1 text frame with content "A" and 1 oval) been inserted into a cell.

i want to find this grouped anchor object by a specific text frame with content "A" or color of oval and change that the whole grouped anchor obj to another grouped anchor object. Is that possible?

TOPICS
Scripting
872
Translate
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
Engaged ,
May 23, 2019 May 23, 2019

Hi,

you could find the anchoredObject in you text with a grep search. The grep character for an anchored object is "~a".

Then you would need to look into the found items. If your condition is maching you remove the anchored object character and replace it with a different object (maybe from a library).

Thanks Stefan

Translate
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 ,
May 26, 2019 May 26, 2019

hello, thanks you Stefan, the problem is.

it's easy to find an anchor object with grep search. Problem is that grouped anchor object contain 1 text frame with specific content, and 1 oval. Let's assume i have 10 anchor object with different attributes. How can i find exactly the anchor object that contain letter "A" in text frame, and color C100 of Oval? The closest idea i got is find by layer or FindObject. But i really dont know how to it with script

Translate
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
Engaged ,
May 27, 2019 May 27, 2019
LATEST

Hi,

here is a code snippet

var curDoc = app.activeDocument;

app.findGrepPreferences.findWhat  = "~a";

var foundItems = curDoc.findGrep();

// is there a TextFrame with Text "A" and an Oval with fill C100

for (var i=0; i<foundItems.length; i++) {

    var curCharacter = foundItems;

    var curPageItems = curCharacter.allPageItems;

    // check curPageItems for Oval and TextFrame

    // ...

}

Translate
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