Quantcast
Channel: Adobe Community : Popular Discussions - InDesign Scripting
Viewing all articles
Browse latest Browse all 15932

Looping through objects - testing links

$
0
0

Hi

I have a script that moves all instances of a linked object according to user defined X,Y values.

In order to do this, I need to loop through all objects with links

What is the best way to do this?

 

As of now, this is what I am doing:

var g = myDoc.allGraphics;
for (var i=0; i<g.length; i++) {     if (g[i].itemLink.name == USER_LINK) {          g[i].parent.move(undefined, [USER_X, USER_Y]);     }
}

 

It works well, however I ran into some problems where link was null

Also, is it always the graphic that is linked, or can its parent be linked as well?

If not, then I can just condition that if itemLink == null - continue

 

 

Any advice and guidance would be much appreciated

Thanks

David


Viewing all articles
Browse latest Browse all 15932

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>