Photoshop Script Auto Crop Advanced CHANGE LOG Version 5.9 (231016) a. Content-aware cropping make compatible with PS v25. b. Add version to error message. Version 5.8 (230822) a. Set 'folderXxxxxLastValid' once selected. b. Miscellaneous. Version 5.7 (230705) a. Internationalize. Version 5.6.2 (230327) a. Use background instead of dupe flat layer if doc not layers. b. Implement isMasked. c. Legacy settings set new properties and remove old properties. d. Add option image less than crop log. e. Add polyfill String prototype 'trim'. f. Add format BMP. g. Add option merge single layer. Version 5.6.1 (230326) a. UI decrease windows spacing to 9 pixels. b. UI remove panel margins. c. Update function 'validateFloat'. d. Update function 'validateInteger'. e. Replace function 'selectHighestNormalVisible' with layerTemp code. f. Update function 'selectLayer' pass layer object instead of id. g. Implement function 'selectionBounds'. h. Add variable lessThanCrop. i. Eliminate 'processDocPrepSave'; put code in process loop. j. Rename function 'processDocCrop' => 'processDoc'. k. Add option image less than crop save to subfolder. l. Bad file format throw error instead of results push. m. Save file add catch check for cancel. n. Miscellaneous. Version 5.6 (221101) a. New function setFolder climb folder hierarchy until one exists. b. Add script variables 'folderXXXXLastValid'. c. Folder property 'fsName' use 'fullName' instead. d. Function getFiles add WEBP to known Photoshop extensions. Version 5.5 (221021) a. Add zoom out after active image done. b. Settings apply function setFolder remove excess return. c. Change default useCAFill to false. d. Select input folder add current location. e. Result when flatten only when process folder. f. Remove path separator when combining pathOutput and subpath. g. Log contents add trailing return. h. Log indexed color. i. No need for fullName of folderInput; same result without fullName. k. Settings apply set list units before value inputs. l. Miscellaneous. Version 5.4 (221015) a. New function selectLayerHighestVisible. b. Honor process choice last used (or default); do not force active image. c. Add code 'handle bottom layer' and restore it. d. Log new 'image is less than crop' messages. e. Function mergeLayers handle vector masks. f. Function mergeLayers incorporate rasterizeLayers as sub-function. g. Miscellaneous. Version 5.3 (221013) a. Set suffix when units change. b. Settings save dialog add include input/output/working folders. c. Settings apply setFolder do not clear value when prop is empty. d. Remove useless function xmpRemoveProfile. e. Interface text 'Margins' add (+/-). Version 5.2 (221010) a. Remove //@target b. Check app name and warn if wrong app for script. c. New handling of files Photoshop can't open. d. Put cropping into function cropImage. e. Don't set output folder to subfolder of input. f. Remember process, subfolders, and input and output folders. g. Do not allow output or working folders to be input folder. h. Use new select subject function that tries twice instead of inline. j. Remove extra item in drop-down lists. k. New handling for subpath. l. Implement new function openFile. m. Folder objects global and create in btnOK.onClick. n. New handling of output file object creation. o. Script global extension, format. p. Function saveAndClose remove excess catch. q. Function saveWorking remove excess var results. r. Update panel 'Settings' to match others. s. Function saveAndClose try all. t. Miscellaneous. Version 5.1 (220803) a. Bring to front and close progress and working at script end. b. Close button false has no effect in Photoshop. c. Correct getFiles() comment. d. Revise function saveAndClose. e. Add script global var extensions. f. JPG save options add matte and scans. a. Use doneMessage instead of var abort. h. Try a second time when select subject fails. i. Log new function addFile to replace logAddFileMessage. j. Replace function notify with alert and confirm. k. Settings current break apart single return statement. l. Settings apply and current try/catch/alert errors. m. Miscellaneous. Version 5.0 (220715) a. Select subject all layers false. b. Use list index instead of text for file format. c. Optimize saving output files. d. Select highest layer only if visible. e. Better error handling for select subject. Version 4.9 (220708) a. Updated function settings.setList. b. Settings replace list add empty item so minimum two items. c. Settings list add empty item so minimum two items. d. Settings unlock move to listSettings.onChange. Version 4.8 (220614) a. Allow periods in suffix. b. Equals or not null make strict comparison. Version 4.7.1 (220525) a. Add function validateFloat for margins to allow negative values. Version 4.7 (220523) a. Set doneInfo and doneMessage to empty strings prior to process. b. Update doneMessage, doneInfo, and notify logic. c. Test error 'User cancel' instead of 'User cancelled'. d. getFiles ignore EPS if not raster. Version 4.6.1 (220522) a. Remove function testCancel. Not necessary. Version 4.6 (220503) a. DialogModes.NO once processing. Version 4.5 (220426) a. Save PNG set compression 5, interlaced false. b. Add DialogModes.ERROR at begin of script. c. Remove DialogModes.ALL. d. Write log to output folder. Version 4.4 (220331) a. Select first normal layer by id instead of name. b. Error app.activeDocument is null when nothing open. Check app.documents.length. Version 4.3 (220329) a. Updated function loadColorProfiles. b. Force integer value when units are pixels. c. When units are pixels, set UI option resample to original to false. d. Updated function processDocCrop. e. When auto-fill, add margin before cropping and remove after. f. Miscellaneous. Version 4.2 (220318) a. Adjust bounds to reach target crop use Math.ceil instead of Math.floor. Math.floor crops 1 pixel too small, that is added after cropping. b. If units are pixels, resize image to precise pixel size after cropping. c. Default to process active image if an image is open. d. Miscellaneous. Version 4.1 (220307) a. Hoist var log. b. Hoist var settings. c. Function setFolder rename control => uiText d. Function setList/listSelection rename control => uiList e. Function validateNumeric rename control => uiEdit f. Drop down lists make array third argument instead of in properties object. g. Verbiage 'pixels/inch' correct capitalization and fix singular instance. h. Improved listUnits.onChange. i. Accept decimal comma. j. Remove call to validateNumeric from configureUi function. k. Do not call changeOption() inside validate functions. l. NEW progress window. m. Process active document, use 'working' window instead of 'progress'. n. When select subject fails, log and save uncropped image. o. Test for no suffix + input/output the same only when processing folder. p. Settings file encoding UTF-8. q. NEW function getFiles. r. Miscellaneous. Version 4.0 (211212) a. Apply settings implement function getProp. b. Apply settings updated setList function. c. Function setFolder pass property name. d. Rename variable listProfile => listProfiles. e. btnOK handler check for profile selected. f. Miscellaneous. Version 3.9 (211203) a. Prevent output to input folder without suffix. Version 3.8 (211130) a. Don't need legacy settings; now a new script. Other tweaks. Version 3.7 (211130) a. Resample use either Preserve Details 2.0 (up) or bicubic sharper (down). b. Miscellaneous. Version 3.5 (211126) a. Rename to "Auto Crop Advanced". Version 3.4 (211125) a. Enhance cropping logic. b. Add option scale when image does not reach crop. c. Make input folder a button instead of radio button. Rearrange UI. d. Miscellaneous. Version 3.3 (211124) a. Fix NaN error if inputs for size/margin empty so value is "0". b. Width, height, and resolution, zero value not allowed. c. Enhance cropping logic. Version 3.2 (211124) a. Delete cropped pixels set false to preserve layer. b. Do not restore background layer, again, to preserve layers always. c. Add margin inputs for all sides. d. Fix error if processing folder and image in it is open. e. Disable layer mask while checking if image reaches crop area. f. Rearrange UI section output. g. Add option save working file psd. h. Miscellaneous.