I had all but the briefest of looks at this and I don't think you can use switch/case like that…? I think 'case' evaluates a variable not an expression… Some one will tell me if Im wrong as normal… You could other wise just chain if/else if… OK had 10 minutes a possible route could be some thing like this using 'case' where you do some math first so case gets a value passed to it… Do check my math thou… I don't see any issue with calling a resize on images that match your value… nothing will happen will it? Oh yeah I was working in pixels as always… #target photoshop
var doc = app.activeDocument;
var docW = doc.width;
var docH = doc.height;
if (docW == docH && docW > 800) {
switch(Math.floor(docW/500)) {
case 5 : doc.resizeImage(2500,undefined,undefined,ResampleMethod.BICUBICSMOOTHER); break;
case 4 : doc.resizeImage(2000,undefined,undefined,ResampleMethod.BICUBICSMOOTHER); break;
case 3 : doc.resizeImage(1500,undefined,undefined,ResampleMethod.BICUBICSMOOTHER); break;
case 2 : doc.resizeImage(1000,undefined,undefined,ResampleMethod.BICUBICSMOOTHER); break;
case 1 : doc.resizeImage(800,undefined,undefined,ResampleMethod.BICUBICSMOOTHER); break;
default : doc.resizeImage(3000,undefined,undefined,ResampleMethod.BICUBICSMOOTHER);
}
}
... View more