This content has been marked as final.
Show 1 reply
-
1. Re: Applescript, crop based on selection without deleting pixels
pixxxel schubser Sep 4, 2014 2:40 PM (in response to Mattmcquiff)Hi Mattmcquiff,
I'm not familiar with AppleScript.
But this JavaScript (with a bit AM code) should do the same:
// CropBasedOnHalfOfPicture.jsx // https://forums.adobe.com/thread/1564681 // regards pixxxelschubser var strtRulerUnits = app.preferences.rulerUnits; app.preferences.rulerUnits = Units.POINTS; var originalWidth = app.activeDocument.width; var originalHeight = app.activeDocument.height; var halfHeight = Math.floor (originalHeight / 2); var desc = new ActionDescriptor(); var idT = charIDToTypeID( "T " ); var desc1 = new ActionDescriptor(); desc1.putUnitDouble( charIDToTypeID( "Top " ), charIDToTypeID( "#Rlt" ), halfHeight ); desc1.putUnitDouble( charIDToTypeID( "Left" ), charIDToTypeID( "#Rlt" ), 0 ); desc1.putUnitDouble( charIDToTypeID( "Btom" ), charIDToTypeID( "#Rlt" ), originalHeight ); desc1.putUnitDouble( charIDToTypeID( "Rght" ), charIDToTypeID( "#Rlt" ), originalWidth ); desc.putObject( idT, charIDToTypeID( "Rctn" ), desc1 ); desc.putUnitDouble( charIDToTypeID( "Angl" ), charIDToTypeID( "#Ang" ), 0.000000 ); desc.putBoolean( charIDToTypeID( "Hd " ), true ); desc.putUnitDouble( charIDToTypeID( "Wdth" ), charIDToTypeID( "#Pxl" ), 0.000000 ); desc.putUnitDouble( charIDToTypeID( "Hght" ), charIDToTypeID( "#Pxl" ), 0.000000 ); desc.putUnitDouble( charIDToTypeID( "Rslt" ), charIDToTypeID( "#Rsl" ), 0.000000 ); executeAction( charIDToTypeID( "Crop" ), desc, DialogModes.NO ); app.preferences.rulerUnits = strtRulerUnits;
Have fun

