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.


only selected anchored objects

New Here ,
Jul 02, 2019 Jul 02, 2019

Copy link to clipboard

Copied

Goodmorning everyone,

having no experience with scripts, I apologize for perhaps stupid questions but I can't do the most trivial things:

to find all the anchored objects I made this script:

var story = app.selection [0] .parentStory;

var anchoredItems = story.pageItems.everyItem (). getElements ();

for (var n = 0; n <anchoredItems.length; n ++) {

........................

......................

};

but I could not understand how to do, if I select only a few lines of text, to find only the anchored objects related to the selection?

Thanks for your help

ivan

TOPICS
Scripting

Views

455

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

Engaged , Jul 02, 2019 Jul 02, 2019

Likes

Translate

Translate
Engaged ,
Jul 02, 2019 Jul 02, 2019

Copy link to clipboard

Copied

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
New Here ,
Jul 03, 2019 Jul 03, 2019

Copy link to clipboard

Copied

thank you for your suggestion

I also found inspiration for other problems

thank you

regards

ivan

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
Explorer ,
Jun 09, 2021 Jun 09, 2021

Copy link to clipboard

Copied

This link is not working. https://forums.adobe.com/message/8635101

Could it be shared as text message?

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
Adobe Community Professional ,
Jun 10, 2021 Jun 10, 2021

Copy link to clipboard

Copied

LATEST
// When text is selected:
var anchoredItems = app.selection[0].allPageItems;

Loop the result array.

That will even catch items in selected text that contains a table with graphic cells or anchored items in text cells.

 

Regards,
Uwe Laubender

( ACP )

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