Question
Script to select objects of the same width & height
Hi, I'm trying to make a script that can select objects of the same dimensions as the selected object.
So far I have this, which doesn't throw up any errors but it also doesn't work. Can anyone help me fix this? I'm new to scripting in Illustrator so I'm not even sure how to check if it's getting the width/height from the currently selected object. Thanks very much!
var docRef=app.activeDocument;
var objWidth = app.selection[0].width;
var objHeight = app.selection[0].height;
var selectionArray = 0;
var str = 0;
var items = docRef.pageItems;
var n = items.length;
for ( i = 0; i < n ; i++ )
{
var item = items[i];
if ( item.width == objWidth
&& item.height == objHeight )
{
selectionArray [ selectionArray.length ] = item;
}
}
