Skip to main content
Plane Wryter
Known Participant
October 27, 2021
Question

How Select All Photo Images into a Javascript Variable Suitable for Iteration Over the Collection?

  • October 27, 2021
  • 1 reply
  • 253 views

In Javascript, how can all photo images contained in an Illustator .AI file--regardless of whether they are on an Artboard or scattered around the Canvas--be programmatically selected and included in a JS variable suitable for iterating over the entire collection?

  • A code snippet would be MOST APPRECIATED!

Many thanks in advance!

Plane Wryter

This topic has been closed for replies.

1 reply

Community Expert
October 28, 2021

Try the following, it will alert the filepath of each placeditem in the currently active AI file

var pi = app.documents[0].placedItems
for(var i = 0; i < pi.length; i++)
{
	alert(pi[i].file)
}

-Manan

-Manan
Plane Wryter
Known Participant
October 28, 2021

Dear Manan,

Many, many thanks for your helpful reply to my request.

  • Your time & talents are valued & appreciated!  

With thanks!

Plane Wryter