Quantcast
Channel: Adobe Community: Message List
Viewing all articles
Browse latest Browse all 154536

Sorting images from the selection

$
0
0

I am writing a script that involves scaling and sorting images. Which means i have to access the geometricBounds property of the images. Now, when the selection contains either an EPS or PDF file the script fails.

So i am trying to filter through the selection array to find images that are NOT EPS or PDF. I noticed that EPS and PDF files don't have geometricBounds. So i was trying to use that property to sort it. But i am running into issues. Any thoughts? Solutions?

 

if(app.documents.length != 0){  if(app.selection.length != 0){  for(myCounter = 0; myCounter < app.selection.length; myCounter++){  switch(app.selection[myCounter].constructor.name)  {  case "GraphicLine":  case "Oval":  case "Polygon":  case "Rectangle":  if(app.selection[myCounter].contentType != ContentType.UNASSIGNED){ // checks to make sure frame contains an image.             if(app.selection[myCounter].graphics[0].geometricBounds[0]) { // checks to see if image has a width property. else it avoids it.           myObjectList.push(app.selection[myCounter]);     }  }  break;  }  }  if(myObjectList.length !=0){                    openDialog(myObjectList, keyObj);  // moveItems(myObjectList);  }  } else {alert("Select some images, fool!")}
}

Viewing all articles
Browse latest Browse all 154536

Trending Articles



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