Skip to main content
Participant
September 25, 2024
Question

Select all graphics with horizontal scale >90% and change them to 100%

  • September 25, 2024
  • 2 replies
  • 176 views

How to select all images with scale >90% and change them to 100%

The following code ignores the if statement and zooms ALL images to 100%

var myDoc = app.activeDocument;
var tfs = myDoc.allGraphics;
var value = 90;
for (var i = 0; i < tfs.length; i++){
if (tfs[i].horizontalScale > value);{
tfs[i].horizontalScale = 100;
tfs[i].verticalScale = 100;
tfs[i].fit(FitOptions.FRAME_TO_CONTENT);
}
}

 

This topic has been closed for replies.

2 replies

James Gifford—NitroPress
Legend
September 25, 2024

NM, read the OP as adjusting text. 🙂

rob day
Community Expert
Community Expert
September 25, 2024

Hi @lucignolo25859033u0ra , try removing the  ;  in the first line of your if statement—should be:

if (tfs[i].horizontalScale > value){

 

Also watchout for the difference between horizontalScale and absoluteHorizontalScale, there could be cases where both the container frame and the graphic are scaled