Hey folks!
I've read a lot of Topics and code lines which can be found here. But I don't know why... I just don't get it. So, what I've done? I've created a good working and stable script, but it work only with images, that have exactly the dimensions of 2848x4288px or 4288x2848px. I started then to write a code, so that all images that have not exactly this dimensions would be brought to this dimensions, without keeping the proportions....but it didn't work.
Here's what I've done till now:
Code: Select all// =======================================================
startRulerUnits = app.preferences.rulerUnits;
startTypeUnits = app.preferences.typeUnits;
startDisplayDialogs = app.displayDialogs;
app.preferences.rulerUnits = Units.PIXELS;
app.preferences.typeUnits = TypeUnits.PIXELS;
app.displayDialogs = DialogModes.NO;
if (docRef.height > dochRef.width) {
var idImgS = charIDToTypeID( "ImgS" );
var desc7 = new ActionDescriptor();
var idWdth = charIDToTypeID( "Wdth" );
var idPxl = charIDToTypeID( "#Pxl" );
desc7.putUnitDouble( idWdth, idPxl, 2848.000000 );
var idHght = charIDToTypeID( "Hght" );
var idPxl = charIDToTypeID( "#Pxl" );
desc7.putUnitDouble( idHght, idPxl, 4288.000000 );
var idIntr = charIDToTypeID( "Intr" );
var idIntp = charIDToTypeID( "Intp" );
var idBcbc = charIDToTypeID( "Bcbc" );
desc7.putEnumerated( idIntr, idIntp, idBcbc );
executeAction( idImgS, desc7, DialogModes.NO );
}
else{
var idImgS = charIDToTypeID( "ImgS" );
var desc7 = new ActionDescriptor();
var idWdth = charIDToTypeID( "Wdth" );
var idPxl = charIDToTypeID( "#Pxl" );
desc7.putUnitDouble( idWdth, idPxl, 4288.000000 );
var idHght = charIDToTypeID( "Hght" );
var idPxl = charIDToTypeID( "#Pxl" );
desc7.putUnitDouble( idHght, idPxl, 2848.000000 );
var idIntr = charIDToTypeID( "Intr" );
var idIntp = charIDToTypeID( "Intp" );
var idBcbc = charIDToTypeID( "Bcbc" );
desc7.putEnumerated( idIntr, idIntp, idBcbc );
executeAction( idImgS, desc7, DialogModes.NO );
}
// =======================================================
The code seems to be like a weird something...not as clear code that can be found in the topics of this forum...sure this is because I work with 'Adobe's Script Listener' and copy & paste the code into my script. It works fine the way along...but not the resizing thing. Additional Info: I work with CS5 and JS, not VB or the Mac-based-language (i've forgotten it's name). I hope somebody could help me out with this...
Greetings,
Garion
Edit: The 'docRef' variable is declined at the top of my script.
Code: Select allvar docRef = activeDocument;
Don't getting the thing with resizing Images
-
larsen67
Don't getting the thing with resizing Images
You have a typo in your if statement… Change the line…
if (docRef.height > dochRef.width) { // loose the h…
Did the ESTK not kick this line back as undefined…? or are you writing in some other app…?
The mac scripting language is AppleScript…
if (docRef.height > dochRef.width) { // loose the h…
Did the ESTK not kick this line back as undefined…? or are you writing in some other app…?
The mac scripting language is AppleScript…
-
Garion
Don't getting the thing with resizing Images
Hey, thanks for the really fast answer. I've erased the typo, but ESTK (yes, I'm working with this little prog) highlights the first line with the first 'if'-phrase...but I don't know why or what's wrong with it.
-
larsen67
Don't getting the thing with resizing Images
And you have declared the variable docRef earlier in this script like you said…? I tested your script with the typo fixed and the other line added and it was fine…
The ESTK should give you some indication of what the error is at the base bar of the debugger window…
The ESTK should give you some indication of what the error is at the base bar of the debugger window…
-
Garion
Don't getting the thing with resizing Images
....
Thank you for the advice with the bar below... I had NOT declined the 'docRef' variable...I did this in an other script
Now it work absolutely fine. Thank you for your quick and competent help.