Quantcast
Channel: Adobe Community : Popular Discussions - Illustrator Scripting
Viewing all articles
Browse latest Browse all 12845

resize method with Javascript in Illustrator CS4

$
0
0

var objectBounds = docRef.visibleBounds;

var W = objectBounds[2] - objectBounds[0];//figures the width

var H = objectBounds[1] - objectBounds[3];//figures the height

 

 

 

// W & H are reporting the size in points ... convert to picas

var picaW = W / 12;

var picaH = H / 12;

 

// do the math for the correct column width: settings / width = percentage in decimal; multiply by 100 to get the decimal place in the right spot.

var endWidth

var percentageX = Math.round((endWidth / picaW) * 100);

 

var percentageY = percentageX;

 

 

for (var a=0; a<docRef.layers.length; a++){

 

     var layerRef = docRef.layers[a];

 

     layerRef.hasSelectedArtwork=true;   // select all

 

 

     // now to resize based on the percentage

 

     layerRef.pageItem.resize(percentageX, percentageY);

 

}

 

The width and height are coming out fine. But in this last line, that resize is just not working. When I run it I get an error that says: undefined is not an object.

The syntax must be wrong ... any ideas?

Thanks in advance!


Viewing all articles
Browse latest Browse all 12845

Trending Articles



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