/* This Javascript program provides a front-end for the GTH-WoodFrames Photoshop Action. It allows from 1 to MAXfRAMES frames to be specified and automatically applied to the currently active image. Of course, the GTH-WoodFrames action must be loaded for this script to work. Written by George T. Hawkins Date: 2/21/2008 */ /******************************************************************************* GLOBAL CONSTANTS *******************************************************************************/ var MAXfRAMES = 20; // maximum number of allowable frames var FRAMEsIZE = [ 'thin', 'medium', 'thick', 'extra thick' ]; var FRAMEwOOD = [ 'blackwood', 'cherry', 'cherry2', 'Honduran rosewood', 'Huanguali', 'Japanese ash', 'maple', 'oak', 'pine', 'padauk', 'Phillippine mahogany', 'rosewood', 'rosewood2', 'striped mahogany' ]; var FRAMEaCTIONsIZE = [ 'Thin', 'Med', 'Thick', 'XtraThick' ]; var FRAMEaCTIONwOOD = [ 'Blackwood', 'Cherry', 'Cherry2', 'HonduranRosewood', 'Huanghuali', 'JapaneseAsh', 'Maple', 'Oak', 'Pine', 'Padauk', 'PhillippineMahogany', 'Rosewood', 'Rosewood2', 'StripedMahogany' ]; /******************************************************************************* GLOBAL VARIABLES *******************************************************************************/ var frameCountRet; // returned text value for frame count var frameCount = 1; // frame count flag (0 = user termination) var currSize = null; // current Frame thickness var currWood = null; // current Frame wood var frameSpecs = []; // total frame specification array // frame specification resource: var frameRes = "dialog { \ info: Panel { \ orientation: 'column', \ text: 'Frame Specification:', \ pIGroup: Group { \ pITitle: StaticText { text: 'Enter data for Frame number x' }, \ }, \ frameSize: Group { \ orientation: 'row', \ sSize: StaticText { text: 'Size of Frame: ' }, \ ddSize: DropDownList { } \ }, \ frameWood: Group { \ orientation: 'row', \ sWood: StaticText { text: 'Type of Wood: ' }, \ ddWood: DropDownList { } \ } \ }, \ buttons: Group { orientation: 'row', \ okBtn: Button { text: 'OK' }, \ cancelBtn: Button { text:'Cancel' } \ } \ }"; /******************************************************************************* SUBROUTINES *******************************************************************************/ // determine frame count: function getFrameCount () { // iteration count resource: var icountRes = "dialog { \ defaultElement: null, \ info: Panel { \ orientation: 'column', \ text: 'Frame Count:', \ frameCount: Group { \ orientation: 'row', \ sText: StaticText { text: 'Enter number of frames desired (between 1 and 99): '}, \ eText: EditText { text: '1', preferredSize: [40, 20] } \ } \ }, \ buttons: Group { orientation: 'row', \ okBtn: Button { text: 'OK' }, \ cancelBtn: Button { text:'Cancel' } \ } \ }"; var winCount = new Window(icountRes); // define frame count window winCount.info.frameCount.sText.text = 'Enter number of frames desired (between 1 and ' + MAXfRAMES + '): '; winCount.defaultElement = null; // code around CS3 bug winCount.buttons.okBtn.onClick = function () { this.parent.parent.close(); } // execute frame count window: winCount.center(); var winReturn = winCount.show(); frameCountRet = winCount.info.frameCount.eText.text; return(winReturn); } // determine specs for ith frame: function getFrame (frameNdx) { var winFrame = new Window(frameRes); // define frame specification window // add thickness dropdown items: for (var fndx=0, flimit=FRAMEsIZE.length; fndxMAXfRAMES) ) { alert('**** Frame count not in range 1...' + MAXfRAMES + ' ****'); return; } } // confirm that we wish to proceed: var result = confirm( 'The frame count will be executed ' + frameCount + ' times; \r Proceed?' ); if (!result) { alert('**** Processing terminated by user ****'); return; } // get individual frame specifications: for(fndx=0; fndx