This one might be what you are looking for:
http://actionlogic.blogspot.com/2006/03/sivas-photoshop-conditional-action.html
// by Sivaratnam Gunaratnam ( sivaratnam@gmail.com )
// for any comments, suggestion, etc, mail me at sivaratnam@gmail.com .
// for FAQ, a quick start guide and help, go to http://actionlogic.blogspot.com .
// Please note that this is a free tool that i decided to share , and that I cannot be held responsible for any damages.
//Contains some codes from Dr.Brown's Image Processor. Thanks a lot.
//
GlobalVariables();
function GlobalVariables() {
// a version for possible expansion issues
gVersion = 1;
var docRef;
var gCancel;
var gLeft;
var gLogic;
var gRight;
var gTruth;
var gtoskip;
var gFolder;
var gcondition;
// A list of file extensions I will skip, keep them lower case
gFilesToSkip = Array( "db", "xmp", "thm", "txt", "doc", "md0", "tb0", "adobebridgedb", "adobebridgedbt", "bc", "bct" );
// A list of camera raw extensions, keep them lower case
gFilesForCameraRaw = Array( "tif", "crw", "nef", "raf", "orf", "mrw", "dcr", "mos", "srf", "pef", "dcr", "cr2", "dng", "erf", "x3f", "raw" );
// limit the length of text in edit boxes by this length
gShortFileNameLengthWin = 30;
gShortFileNameLengthMac = 22;
gShortFileNameLength = gShortFileNameLengthMac;
// remember the dialog modes
gSaveDialogMode = app.displayDialogs;
app.displayDialogs = DialogModes.NO;
gClassActionSet = charIDToTypeID( 'ASet' );
gClassAction = charIDToTypeID( 'Actn' );
gKeyName = charIDToTypeID( 'Nm ' );
gKeyNumberOfChildren = charIDToTypeID( 'NmbC' );
// all the strings that need localized
strTitle = localize( "$$$/JavaScript/ImageProcessor/Title=Image Processor" );
strLabelSource = localize( "$$$/JavaScripts/ImageProcessor/Source=Select the images to process" );
strNoImagesSelected = localize( "$$$/JavaScripts/ImageProcessor/NoImagesSelected=No images have been selected" );
strNoFolderSelected = localize( "$$$/JavaScripts/ImageProcessor/NoFolderSelected=No folder has been selected" );
strLabelSourceHelp = localize( "$$$/JavaScripts/ImageProcessor/SourceHelp=Location of files to process" );
strLabelDestination = localize( "$$$/JavaScripts/ImageProcessor/Destination=Select location to save processed images" );
strSaveInSameLocation = localize( "$$$/JavaScripts/ImageProcessor/SaveInSameLocation=S&ave in Same Location" );
strSaveInSameLocationHelp = localize( "$$$/JavaScripts/ImageProcessor/SaveInSameLocationHelp=Save the new documents next to the original documents" );
strUseOpen = localize( "$$$/JavaScripts/ImageProcessor/UseOpen=Use Open &Images" );
strUseOpenHelp = localize( "$$$/JavaScripts/ImageProcessor/UseOpenHelp=Use the images that are currently open" );
strButtonBrowse1 = localize( "$$$/JavaScripts/ImageProcessor/Browse1=Select &Folder..." );
strButtonBrowse2 = localize( "$$$/JavaScripts/ImageProcessor/Browse2=Sele&ct Folder..." );
strButtonRun = localize( "$$$/JavaScripts/ImageProcessor/Run=Run" );
strOpenFirst = localize( "$$$/JavaScripts/ImageProcessor/OpenFirst=&Open first image to apply settings" );
strOpenFirstHelp = localize( "$$$/JavaScripts/ImageProcessor/OpenFirstHelp=Show the Camera RAW dialog on the first image to apply settings" );
strBridge = localize( "$$$/JavaScripts/ImageProcessor/Bridge=Process files from Bridge only" );
strBridgeHelp = localize( "$$$/JavaScripts/ImageProcessor/BridgeHelp=Selected files from Bridge will be processed" );
strButtonCancel = localize("$$$/JavaScripts/ImageProcessor/Cancel=Cancel");
strButtonLoad = localize("$$$/JavaScripts/ImageProcessor/Load=&Load...");
strButtonLoadHelp = localize("$$$/JavaScripts/ImageProcessor/LoadHelp=Load a settings file from disk");
strButtonSave = localize("$$$/JavaScripts/ImageProcessor/Save=&Save...");
strButtonSaveHelp = localize("$$$/JavaScripts/ImageProcessor/SaveHelp=Save the current dialog settings to disk");
strICC = localize( "$$$/JavaScripts/ImageProcessor/ICC=Inclu&de ICC Profile" );
strICCHelp = localize( "$$$/JavaScripts/ImageProcessor/ICCHelp=Include the ICC Profile when saving the file" );
strFileType = localize( "$$$/JavaScripts/ImageProcessor/FileType=File Type" );
strPreferences = localize( "$$$/JavaScripts/ImageProcessor/Preferences=Preferences" );
strRunAction = localize( "$$$/JavaScripts/ImageProcessor/RunAction=R&un Action:" );
strActionHelp = localize( '$$$/JavaScript/ImageProcessor/ActionHelp=Select an action set and an action' );
strSaveAsJPEG = localize( "$$$/JavaScripts/ImageProcessor/SaveAsJPEG=Save as &JPEG" );
strSaveAsJPEGHelp = localize( "$$$/JavaScripts/ImageProcessor/SaveAsJPEGHelp=Save a file to the JPEG format" );
strQuality = localize( "$$$/JavaScripts/ImageProcessor/Quality=Quality:" );
strConvertICC = localize( "$$$/JavaScripts/ImageProcessor/Convert=Con&vert Profile to sRGB" );
strConvertICCHelp = localize( "$$$/JavaScripts/ImageProcessor/ConvertHelp=Convert the ICC profile to sRGB before saving" );
strResizeToFit1 = localize( "$$$/JavaScripts/ImageProcessor/ResizeToFit1=&Resize to Fit" );
strResizeToFit2 = localize( "$$$/JavaScripts/ImageProcessor/ResizeToFit2=R&esize to Fit" );
strResizeToFit3 = localize( "$$$/JavaScripts/ImageProcessor/ResizeToFit3=Resi&ze to Fit" );
strResizeToFitHelp = localize( "$$$/JavaScripts/ImageProcessor/ResizeToFitHelp=Select to resize for this format" );
strSaveAsPSD = localize( "$$$/JavaScripts/ImageProcessor/SaveAsPSD=Save as &PSD" );
strSaveAsPSDHelp = localize( "$$$/JavaScripts/ImageProcessor/SaveAsPSDHelp=Save a file to the PSD format" );
strMaximize = localize( "$$$/JavaScripts/ImageProcessor/Maximize=&Maximize Compatibility" );
strMaximizeHelp = localize( "$$$/JavaScripts/ImageProcessor/MaximizeHelp=Maximize compatibility when saving to PSD format" );
strSaveAsTIFF = localize( "$$$/JavaScripts/ImageProcessor/SaveAsTIFF=Save as &TIFF" );
strSaveAsTIFFHelp = localize( "$$$/JavaScripts/ImageProcessor/SaveAsTIFFHelp=Save a file to the TIFF format" );
strLZW = localize( "$$$/JavaScripts/ImageProcessor/LZW=LZ&W Compression" );
strLZWHelp = localize( "$$$/JavaScripts/ImageProcessor/LZWHelp=Use LZW compression when saving in TIFF format" );
strCopyright = localize( "$$$/JavaScripts/ImageProcessor/Copyright=Copyright Info:" );
strCopyrightHelp = localize( "$$$/JavaScripts/ImageProcessor/CopyrightHelp=Add text to copyright your images" );
strW = localize( "$$$/JavaScripts/ImageProcessor/W=W:" );
strWHelp = localize( "$$$/JavaScripts/ImageProcessor/WHelp=Type in a width to resize image" );
strH = localize( "$$$/JavaScripts/ImageProcessor/H=H:" );
strHHelp = localize( "$$$/JavaScripts/ImageProcessor/HHelp=Type in a height to resize image" );
strPX = localize( "$$$/JavaScripts/ImageProcessor/PX=px" );
strPresets = localize( "$$$/JavaScripts/ImageProcessor/Presets=Presets" );
strPickXML = localize( "$$$/JavaScripts/ImageProcessor/PickXML=Pick a XML file to load" );
strPickXMLWin = localize( "$$$/JavaScripts/ImageProcessor/PickXMLWin=XML Files: *.xml" );
strPickXMLSave = localize( "$$$/JavaScripts/ImageProcessor/PickXMLSave=Pick a XML file to save" );
strPickSource = localize( "$$$/JavaScripts/ImageProcessor/PickSource=Pick a source folder" );
strPickDest = localize( "$$$/JavaScripts/ImageProcessor/PickDest=Pick a destination folder" );
strSpecifySource = localize( "$$$/JavaScripts/ImageProcessor/SpecifySource=Please specify a source folder." );
strSpecifyDest = localize( "$$$/JavaScripts/ImageProcessor/SpecifyDest=Please specify a destination folder." );
strJPEGQuality = localize( "$$$/JavaScripts/ImageProcessor/JPEGQuality=JPEG Quality must be between 0 and 12." );
strJPEGWandH = localize( "$$$/JavaScripts/ImageProcessor/JPEGWandH=You must specify width and height when using resize image options for JPEG." );
strTIFFWandH = localize( "$$$/JavaScripts/ImageProcessor/TIFFWandH=You must specify width and height when using resize image options for TIFF." );
strPSDWandH = localize( "$$$/JavaScripts/ImageProcessor/PSDWandH=You must specify width and height when using resize image options for PSD." );
strOneType = localize( "$$$/JavaScripts/ImageProcessor/OneType=You must save to at least one file type." );
strNotaRAW = localize( "$$$/JavaScripts/ImageProcessor/NotARAW=This is not a camera raw file according to my list of extensions, " );
strWidthAndHeight = localize( "$$$/JavaScripts/ImageProcessor/WidthAndHeight=Width and Height must be defined to use FitImage function!" );
strMustUse = localize( "$$$/JavaScripts/ImageProcessor/MustUse=You must use Photoshop CS 2 or later to run this script!" );
strSorry = localize( "$$$/JavaScripts/ImageProcessor/Sorry=Sorry, something major happened and I can't continue! Would you like to see more info?" );
strMustSaveOpen = localize( "$$$/JavaScripts/ImageProcessor/MustSaveOpen=Open files must be saved before they can be used by the Image Processor." );
strFollowing = localize( "$$$/JavaScripts/ImageProcessor/Following=The following files will not be saved." );
}
var windowres = "dialog{text:'Conditional Actions' ,bounds:[100,100,870,920],\
panel0:Panel{bounds:[20,30,740,160] , text:'Select Images' ,properties:{borderStyle:'etched',su1PanelCoordinates:true},\
rbUseOpenImage:RadioButton{bounds:[60,30,161,51] , text:'Use Open Image' },\
rbSelectFolder:RadioButton{bounds:[60,60,181,81] , text:'Select From Folder ' },\
btnSelectFolder:Button{bounds:[210,60,310,80] , text:'Browse...' },\
stxtFolderPath:StaticText{bounds:[360,70,700,110] , text:'' ,properties:{scrolling:undefined,multiline:true}}\
},\
panel1:Panel{bounds:[20,170,740,590] , text:'Condition' ,properties:{borderStyle:'etched',su1PanelCoordinates:true},\
btnLoadCondition:Button{bounds:[30,30,130,50] , text:'Load Condition...' },\
statictext1:StaticText{bounds:[30,80,130,97] , text:'If The Image' ,properties:{scrolling:undefined,multiline:true}},\
ddLeft:DropDownList{bounds:[30,110,210,130]},\
ddLogic:DropDownList{bounds:[230,110,380,130]},\
ddRight:DropDownList{bounds:[390,110,570,130]},\
txtInputValue:EditText{bounds:[580,110,680,130] , text:'' ,properties:{multiline:false,noecho:false,readonly:false}},\
statictext2:StaticText{bounds:[30,170,90,187] , text:'Then' ,properties:{scrolling:undefined,multiline:true}},\
ddThen:DropDownList{bounds:[30,200,210,220]},\
ddSet:DropDownList{bounds:[250,200,450,220]},\
ddAction:DropDownList{bounds:[490,200,690,220]},\
stxtUnit:StaticText{bounds:[600,90,700,110] , text:'' ,properties:{scrolling:undefined,multiline:true}},\
statictext4:StaticText{bounds:[30,270,60,287] , text:'Else' ,properties:{scrolling:undefined,multiline:true}},\
ddElse:DropDownList{bounds:[30,300,210,320]},\
ddSetElse:DropDownList{bounds:[250,300,450,320]},\
ddActionElse:DropDownList{bounds:[490,300,690,320]},\
btnSaveCondition:Button{bounds:[580,360,680,380] , text:'Save Condition..' }\
},\
btnRun:Button{bounds:[150,630,270,670] , text:'Run' },\
btnCancel:Button{bounds:[320,630,440,670] , text:'Cancel' }\
}";
dlgMain = new Window(windowres);
gCancel = true;
dlgMain.panel1.btnSaveCondition.visible = false;
dlgMain.panel1.btnLoadCondition.visible = false;
if ( app.documents.length > 0 ) {
dlgMain.panel0.rbUseOpenImage.value = true;
dlgMain.panel0.btnSelectFolder.enabled = false;
dlgMain.panel0.rbSelectFolder.value = false;
docRef = app.activeDocument;
}
else {
dlgMain.panel0.rbUseOpenImage.value = false;
dlgMain.panel0.rbUseOpenImage.enabled = false;
dlgMain.panel0.rbSelectFolder.value = true;
}
dlgMain.panel0.rbUseOpenImage.onClick = function() {
dlgMain.panel0.btnSelectFolder.enabled = false;
dlgMain.panel0.rbUseOpenImage.value = true;
dlgMain.panel0.rbSelectFolder.value = false;
docRef = app.activeDocument;
}
dlgMain.panel0.rbSelectFolder.onClick = function() {
dlgMain.panel0.btnSelectFolder.enabled = true;
dlgMain.panel0.rbUseOpenImage.value = false;
dlgMain.panel0.rbSelectFolder.value = true;
// docRef = ???;
}
dlgMain.panel1.ddLeft.add( "item", 'Format' );
dlgMain.panel1.ddLeft.add( "item", 'Height' );
dlgMain.panel1.ddLeft.add( "item", 'Width' );
dlgMain.panel1.ddLeft.add( "item", 'File Size (KB)' );
dlgMain.panel1.ddLeft.add( "item", 'File Name - without extension' );
dlgMain.panel1.ddLeft.add( "item", 'File Name - with extension' );
dlgMain.panel1.ddLeft.add( "item", 'Resolution' );
dlgMain.panel1.ddLeft.add( "item", 'Color Mode' );
dlgMain.panel1.ddLeft.add( "item", 'Color Profile Name' );
dlgMain.panel1.ddLeft.add( "item", 'Color Profile Type' );
dlgMain.panel1.ddLeft.add( "item", 'Bits per Channel' );
dlgMain.panel1.ddLeft.add( "item", 'Pixel Aspect Ratio' );
dlgMain.panel1.ddLeft.add( "item", 'Author' );
dlgMain.panel1.ddLeft.add( "item", 'Caption' );
dlgMain.panel1.ddLeft.add( "item", 'Category' );
dlgMain.panel1.ddLeft.add( "item", 'Copyright Type' );
dlgMain.panel1.ddLeft.add( "item", 'Copyright Notice' );
dlgMain.panel1.ddLeft.add( "item", 'Country' );
dlgMain.panel1.ddLeft.add( "item", 'Exif' );
dlgMain.panel1.ddLeft.add( "item", 'Keywords' );
dlgMain.panel1.ddLeft.add( "item", 'Title' );
dlgMain.panel1.ddLeft.items[0].selected = true;
dlgMain.panel1.txtInputValue.text ='';
dlgMain.panel1.txtInputValue.enabled = false;
dlgMain.panel1.stxtUnit.text = "";
dlgMain.panel1.ddThen.add( "item", 'Do Nothing' );
dlgMain.panel1.ddThen.add( "item", 'Run Action' );
dlgMain.panel1.ddThen.items[0].selected = true;
dlgMain.panel1.ddElse.add( "item", 'Do Nothing' );
dlgMain.panel1.ddElse.add( "item", 'Run Action' );
dlgMain.panel1.ddElse.items[0].selected = true;
dlgMain.panel1.ddLeft.onChange = function (){
dlgMain.panel1.ddLogic.removeAll();
dlgMain.panel1.ddRight.removeAll();
dlgMain.panel1.txtInputValue.text ='';
dlgMain.panel1.txtInputValue.enabled = false;
dlgMain.panel1.stxtUnit.text = "";
if (dlgMain.panel1.ddLeft.selection.text == "Format") {
dlgMain.panel1.ddLogic.add ( "item", 'Is' ).value = '==';
dlgMain.panel1.ddLogic.add ( "item", 'Is Not' ).value = '!=';
dlgMain.panel1.ddLogic.items[0].selected = true;
dlgMain.panel1.ddRight.add ( "item", 'JPG, JPEG' ).value = 'JPG';
dlgMain.panel1.ddRight.add ( "item", 'PSD' ).value = 'PSD';
dlgMain.panel1.ddRight.add ( "item", 'BMP' ).value = 'BMP';
dlgMain.panel1.ddRight.add ( "item", 'TIF, TIFF' ).value = 'TIF';
dlgMain.panel1.ddRight.add ( "item", 'GIF' ).value = 'GIF';
dlgMain.panel1.ddRight.add ( "item", 'PDD' ).value = 'PDD';
dlgMain.panel1.ddRight.add ( "item", 'EPS' ).value = 'EPS';
dlgMain.panel1.ddRight.add ( "item", 'PCT' ).value = 'PCT';
dlgMain.panel1.ddRight.add ( "item", 'PICT' ).value = 'PICT';
dlgMain.panel1.ddRight.add ( "item", 'PNG' ).value = 'PNG';
dlgMain.panel1.ddRight.add ( "item", 'PXR' ).value = 'PXR';
dlgMain.panel1.ddRight.add ( "item", 'HDR' ).value = 'HDR';
dlgMain.panel1.ddRight.add ( "item", 'TGA' ).value = 'TGA';
dlgMain.panel1.ddRight.add ( "item", 'WBM' ).value = 'WBM';
dlgMain.panel1.ddRight.add ( "item", 'WBMP' ).value = 'WBMP';
dlgMain.panel1.ddRight.items[0].selected = true;
}
if (dlgMain.panel1.ddLeft.selection.text == "Height") {
dlgMain.panel1.ddLogic.add ( "item", 'Equals' ).value = '==';
dlgMain.panel1.ddLogic.add ( "item", 'Is Greater Than' ).value = '>';
dlgMain.panel1.ddLogic.add ( "item", 'Is Lesser Than' ).value = '<';
dlgMain.panel1.ddLogic.add ( "item", 'Is Equals or Greater Than' ).value = '>=';
dlgMain.panel1.ddLogic.add ( "item", 'Is Equals or Lesser Than' ).value = '<=';
dlgMain.panel1.ddLogic.add ( "item", 'Does Not Equal' ).value = '!=';
dlgMain.panel1.ddLogic.items[0].selected = true;
dlgMain.panel1.ddRight.add ( "item", 'Value..' );
dlgMain.panel1.ddRight.add ( "item", 'Width' );
dlgMain.panel1.stxtUnit.text = "pixels";
dlgMain.panel1.ddRight.items[1].selected = true;
}
if (dlgMain.panel1.ddLeft.selection.text == "Width") {
dlgMain.panel1.ddLogic.add ( "item", 'Equals' ).value = '==';
dlgMain.panel1.ddLogic.add ( "item", 'Is Greater Than' ).value = '>';
dlgMain.panel1.ddLogic.add ( "item", 'Is Lesser Than' ).value = '<';
dlgMain.panel1.ddLogic.add ( "item", 'Is Equals or Greater Than' ).value = '>=';
dlgMain.panel1.ddLogic.add ( "item", 'Is Equals or Lesser Than' ).value = '<=';
dlgMain.panel1.ddLogic.add ( "item", 'Does Not Equal' ).value = '!=';
dlgMain.panel1.ddLogic.items[0].selected = true;
dlgMain.panel1.ddRight.add ( "item", 'Value..' );
dlgMain.panel1.ddRight.add ( "item", 'Height' );
dlgMain.panel1.stxtUnit.text = "pixels";
dlgMain.panel1.ddRight.items[1].selected = true;
}
if (dlgMain.panel1.ddLeft.selection.text == "File Size (KB)") {
dlgMain.panel1.ddLogic.add ( "item", 'Equals' ).value = '==';
dlgMain.panel1.ddLogic.add ( "item", 'Is Greater Than' ).value = '>';
dlgMain.panel1.ddLogic.add ( "item", 'Is Lesser Than' ).value = '<';
dlgMain.panel1.ddLogic.add ( "item", 'Is Equals or Greater Than' ).value = '>=';
dlgMain.panel1.ddLogic.add ( "item", 'Is Equals or Lesser Than' ).value = '<=';
dlgMain.panel1.ddLogic.add ( "item", 'Does Not Equal' ).value = '!=';
dlgMain.panel1.ddLogic.items[0].selected = true;
dlgMain.panel1.ddRight.add ( "item", 'Value..' );
dlgMain.panel1.ddRight.items[0].selected = true;
dlgMain.panel1.stxtUnit.text = "Kilo Bytes";
}
if (dlgMain.panel1.ddLeft.selection.text == "File Name - without extension") {
dlgMain.panel1.ddLogic.add ( "item", 'Is' ).value = '==';
dlgMain.panel1.ddLogic.add ( "item", 'Is Not' ).value = '!=';
dlgMain.panel1.ddLogic.add ( "item", 'Contains' );
dlgMain.panel1.ddLogic.add ( "item", 'Does Not Contain' );
dlgMain.panel1.ddLogic.items[0].selected = true;
dlgMain.panel1.ddRight.add ( "item", 'Value..' );
dlgMain.panel1.ddRight.items[0].selected = true;
dlgMain.panel1.stxtUnit.text = "word";
}
if (dlgMain.panel1.ddLeft.selection.text == "File Name - with extension") {
dlgMain.panel1.ddLogic.add ( "item", 'Is' ).value = '==';
dlgMain.panel1.ddLogic.add ( "item", 'Is Not' ).value = '!=';
dlgMain.panel1.ddLogic.add ( "item", 'Contains' );
dlgMain.panel1.ddLogic.add ( "item", 'Does Not Contain' );
dlgMain.panel1.ddLogic.items[0].selected = true;
dlgMain.panel1.ddRight.add ( "item", 'Value..' );
dlgMain.panel1.ddRight.items[0].selected = true;
dlgMain.panel1.stxtUnit.text = "word";
}
if (dlgMain.panel1.ddLeft.selection.text == "Resolution") {
dlgMain.panel1.ddLogic.add ( "item", 'Equals' ).value = '==';
dlgMain.panel1.ddLogic.add ( "item", 'Is Greater Than' ).value = '>';
dlgMain.panel1.ddLogic.add ( "item", 'Is Lesser Than' ).value = '<';
dlgMain.panel1.ddLogic.add ( "item", 'Is Equals or Greater Than' ).value = '>=';
dlgMain.panel1.ddLogic.add ( "item", 'Is Equals or Lesser Than' ).value = '<=';
dlgMain.panel1.ddLogic.add ( "item", 'Does Not Equal' ).value = '!=';
dlgMain.panel1.ddLogic.items[0].selected = true;
dlgMain.panel1.ddRight.add ( "item", 'Value..' );
dlgMain.panel1.ddRight.items[0].selected = true;
dlgMain.panel1.stxtUnit.text = "pixels/inch";
}
if (dlgMain.panel1.ddLeft.selection.text == "Color Mode") {
dlgMain.panel1.ddLogic.add ( "item", 'Is' ).value = '==';
dlgMain.panel1.ddLogic.add ( "item", 'Is Not' ).value = '!=';
dlgMain.panel1.ddLogic.items[0].selected = true;
dlgMain.panel1.ddRight.add ( "item", 'CMYK' ).value = 'DocumentMode.CMYK';
dlgMain.panel1.ddRight.add ( "item", 'RGB' ).value = 'DocumentMode.RGB';
dlgMain.panel1.ddRight.add ( "item", 'LAB' ).value = 'DocumentMode.LAB';
dlgMain.panel1.ddRight.add ( "item", 'BITMAP' ).value = 'DocumentMode.BITMAP';
dlgMain.panel1.ddRight.add ( "item", 'DUOTONE' ).value = 'DocumentMode.DUOTONE';
dlgMain.panel1.ddRight.add ( "item", 'GRAYSCALE' ).value = 'DocumentMode.GRAYSCALE';
dlgMain.panel1.ddRight.add ( "item", 'MULTICHANNEL' ).value = 'DocumentMode.MULTICHANNEL';
dlgMain.panel1.ddRight.add ( "item", 'INDEXEDCOLOR' ).value = 'DocumentMode.INDEXEDCOLOR';
dlgMain.panel1.ddRight.items[0].selected = true;
}
if (dlgMain.panel1.ddLeft.selection.text == "Bits per Channel") {
dlgMain.panel1.ddLogic.add ( "item", 'Is' ).value = '==';
dlgMain.panel1.ddLogic.add ( "item", 'Is Not' ).value = '!=';
dlgMain.panel1.ddLogic.items[0].selected = true;
dlgMain.panel1.ddRight.add ( "item", '8 Bits/Channel' ).value = 'BitsPerChannelType.EIGHT';
dlgMain.panel1.ddRight.add ( "item", '16 Bits/Channel' ).value = 'BitsPerChannelType.SIXTEEN';
dlgMain.panel1.ddRight.add ( "item", '32 Bits/Channel' ).value = 'BitsPerChannelType.THIRTYTWO';
dlgMain.panel1.ddRight.add ( "item", '1 Bits/Channel' ).value = 'BitsPerChannelType.ONE';
dlgMain.panel1.ddRight.items[0].selected = true;
}
if (dlgMain.panel1.ddLeft.selection.text == "Pixel Aspect Ratio") {
dlgMain.panel1.ddLogic.add ( "item", 'Equals' ).value = '==';
dlgMain.panel1.ddLogic.add ( "item", 'Is Greater Than' ).value = '>';
dlgMain.panel1.ddLogic.add ( "item", 'Is Lesser Than' ).value = '<';
dlgMain.panel1.ddLogic.add ( "item", 'Is Equals or Greater Than' ).value = '>=';
dlgMain.panel1.ddLogic.add ( "item", 'Is Equals or Lesser Than' ).value = '<=';
dlgMain.panel1.ddLogic.add ( "item", 'Does Not Equal' ).value = '!=';
dlgMain.panel1.ddLogic.items[0].selected = true;
dlgMain.panel1.ddRight.add ( "item", 'Square' ).value = 1;
dlgMain.panel1.ddRight.add ( "item", 'D1/DV NTSC (0.9)' ).value = 0.9;
dlgMain.panel1.ddRight.add ( "item", 'D4/D16 Standard (0.95)' ).value = 0.95;
dlgMain.panel1.ddRight.add ( "item", 'D1/DV PAL (1.066)' ).value = 1.066;
dlgMain.panel1.ddRight.add ( "item", 'D1/DV NTSC WideScreen (1.2)' ).value = 1.2;
dlgMain.panel1.ddRight.add ( "item", 'HDV Anamorphic (1.333)' ).value = 1.333;
dlgMain.panel1.ddRight.add ( "item", 'D1/DV PAL WideScreen (1.422)' ).value = 1.422;
dlgMain.panel1.ddRight.add ( "item", 'D4/D16 Anamorphic (1.9)' ).value = 1.9;
dlgMain.panel1.ddRight.add ( "item", 'Anamorphic 2:1 (2)' ).value = 2;
dlgMain.panel1.ddRight.items[0].selected = true;
}
if (dlgMain.panel1.ddLeft.selection.text == "Color Profile Type") {
dlgMain.panel1.ddLogic.add ( "item", 'Is' ).value = '==';
dlgMain.panel1.ddLogic.add ( "item", 'Is Not' ).value = '!=';
dlgMain.panel1.ddLogic.items[0].selected = true;
dlgMain.panel1.ddRight.add ( "item", 'WORKING' ).value = 'ColorProfile.WORKING';
dlgMain.panel1.ddRight.add ( "item", 'CUSTOM' ).value = 'ColorProfile.CUSTOM';
dlgMain.panel1.ddRight.add ( "item", 'NONE' ).value = 'ColorProfile.NONE';
dlgMain.panel1.ddRight.items[0].selected = true;
}
if (dlgMain.panel1.ddLeft.selection.text == "Color Profile Name") {
dlgMain.panel1.ddLogic.add ( "item", 'Is' ).value = '==';
dlgMain.panel1.ddLogic.add ( "item", 'Is Not' ).value = '!=';
dlgMain.panel1.ddLogic.items[0].selected = true;
dlgMain.panel1.ddRight.add ( "item", 'Adobe RGB (1998)' ).value = 'Adobe RGB (1998)';
dlgMain.panel1.ddRight.add ( "item", 'Apple RGB' ).value = 'Apple RGB';
dlgMain.panel1.ddRight.add ( "item", 'ColorMatch RGB' ).value = 'ColorMatch RGB';
dlgMain.panel1.ddRight.add ( "item", 'sRGB IEC61966-2.1' ).value = 'sRGB IEC61966-2.1';
dlgMain.panel1.ddRight.add ( "item", 'CIE RGB' ).value = 'CIE RGB';
dlgMain.panel1.ddRight.add ( "item", 'e-sRGB' ).value = 'e-sRGB';
dlgMain.panel1.ddRight.add ( "item", 'KODAK DC Series Digital Camera' ).value = 'KODAK DC Series Digital Camera';
dlgMain.panel1.ddRight.add ( "item", 'NTSC (1953)' ).value = 'NTSC (1953)';
dlgMain.panel1.ddRight.add ( "item", 'PAL/SECAM' ).value = 'PAL/SECAM';
dlgMain.panel1.ddRight.add ( "item", 'ProPhoto RGB' ).value = 'ProPhoto RGB';
dlgMain.panel1.ddRight.add ( "item", 'ROMM-RGB' ).value = 'ROMM-RGB';
dlgMain.panel1.ddRight.add ( "item", 'SMPTE-C' ).value = 'SMPTE-C';
dlgMain.panel1.ddRight.add ( "item", 'Wide Gamut RGB' ).value = 'Wide Gamut RGB';
dlgMain.panel1.ddRight.add ( "item", 'U.S. Web Coated (SWOP) v2' ).value = 'U.S. Web Coated (SWOP) v2';
dlgMain.panel1.ddRight.add ( "item", 'Europe ISO Coated FOGRA27' ).value = 'Europe ISO Coated FOGRA27';
dlgMain.panel1.ddRight.add ( "item", 'Euroscale Coated v2' ).value = 'Euroscale Coated v2';
dlgMain.panel1.ddRight.add ( "item", 'Euroscale Uncoated v2' ).value = 'Euroscale Uncoated v2';
dlgMain.panel1.ddRight.add ( "item", 'Japan Color 2001 Coated' ).value = 'Japan Color 2001 Coated';
dlgMain.panel1.ddRight.add ( "item", 'Japan Color 2001 Uncoated' ).value = 'Japan Color 2001 Uncoated';
dlgMain.panel1.ddRight.add ( "item", 'Japan Color 2002 Newspaper' ).value = 'Japan Color 2002 Newspaper';
dlgMain.panel1.ddRight.add ( "item", 'Japan Web Coated (Ad)' ).value = 'Japan Web Coated (Ad)';
dlgMain.panel1.ddRight.add ( "item", 'U.S. Sheetfed Coated v2' ).value = 'U.S. Sheetfed Coated v2';
dlgMain.panel1.ddRight.add ( "item", 'U.S. Sheetfed Uncoated v2' ).value = 'U.S. Sheetfed Uncoated v2';
dlgMain.panel1.ddRight.add ( "item", 'U.S. Web Coated (SWOP) v2' ).value = 'U.S. Web Coated (SWOP) v2';
dlgMain.panel1.ddRight.add ( "item", 'U.S. Web Uncoated v2' ).value = 'U.S. Web Uncoated v2';
dlgMain.panel1.ddRight.items[0].selected = true;
}
if (dlgMain.panel1.ddLeft.selection.text == "Author") {
dlgMain.panel1.ddLogic.add ( "item", 'Is' ).value = '==';
dlgMain.panel1.ddLogic.add ( "item", 'Is Not' ).value = '!=';
dlgMain.panel1.ddLogic.add ( "item", 'Contains' );
dlgMain.panel1.ddLogic.add ( "item", 'Does Not Contain' );
dlgMain.panel1.ddLogic.items[0].selected = true;
dlgMain.panel1.ddRight.add ( "item", 'Value..' );
dlgMain.panel1.ddRight.items[0].selected = true;
dlgMain.panel1.stxtUnit.text = "word";
}
if (dlgMain.panel1.ddLeft.selection.text == "Caption") {
dlgMain.panel1.ddLogic.add ( "item", 'Is' ).value = '==';
dlgMain.panel1.ddLogic.add ( "item", 'Is Not' ).value = '!=';
dlgMain.panel1.ddLogic.add ( "item", 'Contains' );
dlgMain.panel1.ddLogic.add ( "item", 'Does Not Contain' );
dlgMain.panel1.ddLogic.items[0].selected = true;
dlgMain.panel1.ddRight.add ( "item", 'Value..' );
dlgMain.panel1.ddRight.items[0].selected = true;
dlgMain.panel1.stxtUnit.text = "word";
}
if (dlgMain.panel1.ddLeft.selection.text == "Category") {
dlgMain.panel1.ddLogic.add ( "item", 'Is' ).value = '==';
dlgMain.panel1.ddLogic.add ( "item", 'Is Not' ).value = '!=';
dlgMain.panel1.ddLogic.add ( "item", 'Contains' );
dlgMain.panel1.ddLogic.add ( "item", 'Does Not Contain' );
dlgMain.panel1.ddLogic.items[0].selected = true;
dlgMain.panel1.ddRight.add ( "item", 'Value..' );
dlgMain.panel1.ddRight.items[0].selected = true;
dlgMain.panel1.stxtUnit.text = "word";
}
if (dlgMain.panel1.ddLeft.selection.text == "Copyright Type") {
dlgMain.panel1.ddLogic.add ( "item", 'Is' ).value = '==';
dlgMain.panel1.ddLogic.add ( "item", 'Is Not' ).value = '!=';
dlgMain.panel1.ddRight.add ( "item", 'COPYRIGHTED WORK' ).value = 'CopyrightedType.COPYRIGHTEDWORK';
dlgMain.panel1.ddRight.add ( "item", 'PUBLIC DOMAIN' ).value = 'CopyrightedType.PUBLICDOMAIN';
dlgMain.panel1.ddRight.add ( "item", 'UNMARKED' ).value = 'CopyrightedType.UNMARKED';
dlgMain.panel1.ddLogic.items[0].selected = true;
dlgMain.panel1.ddRight.items[0].selected = true;
}
if (dlgMain.panel1.ddLeft.selection.text == "Copyright Notice") {
dlgMain.panel1.ddLogic.add ( "item", 'Is' ).value = '==';
dlgMain.panel1.ddLogic.add ( "item", 'Is Not' ).value = '!=';
dlgMain.panel1.ddLogic.add ( "item", 'Contains' );
dlgMain.panel1.ddLogic.add ( "item", 'Does Not Contain' );
dlgMain.panel1.ddLogic.items[0].selected = true;
dlgMain.panel1.ddRight.add ( "item", 'Value..' );
dlgMain.panel1.ddRight.items[0].selected = true;
dlgMain.panel1.stxtUnit.text = "word";
}
if (dlgMain.panel1.ddLeft.selection.text == "Country") {
dlgMain.panel1.ddLogic.add ( "item", 'Is' ).value = '==';
dlgMain.panel1.ddLogic.add ( "item", 'Is Not' ).value = '!=';
dlgMain.panel1.ddLogic.add ( "item", 'Contains' );
dlgMain.panel1.ddLogic.add ( "item", 'Does Not Contain' );
dlgMain.panel1.ddLogic.items[0].selected = true;
dlgMain.panel1.ddRight.add ( "item", 'Value..' );
dlgMain.panel1.ddRight.items[0].selected = true;
dlgMain.panel1.stxtUnit.text = "word";
}
if (dlgMain.panel1.ddLeft.selection.text == "Exif") {
dlgMain.panel1.ddLogic.add ( "item", 'Is' ).value = '==';
dlgMain.panel1.ddLogic.add ( "item", 'Is Not' ).value = '!=';
dlgMain.panel1.ddLogic.add ( "item", 'Contains' );
dlgMain.panel1.ddLogic.add ( "item", 'Does Not Contain' );
dlgMain.panel1.ddLogic.items[0].selected = true;
dlgMain.panel1.ddRight.add ( "item", 'Value..' );
dlgMain.panel1.ddRight.items[0].selected = true;
dlgMain.panel1.stxtUnit.text = "word";
}
if (dlgMain.panel1.ddLeft.selection.text == "Keywords") {
dlgMain.panel1.ddLogic.add ( "item", 'Is' ).value = '==';
dlgMain.panel1.ddLogic.add ( "item", 'Is Not' ).value = '!=';
dlgMain.panel1.ddLogic.add ( "item", 'Contains' );
dlgMain.panel1.ddLogic.add ( "item", 'Does Not Contain' );
dlgMain.panel1.ddLogic.items[0].selected = true;
dlgMain.panel1.ddRight.add ( "item", 'Value..' );
dlgMain.panel1.ddRight.items[0].selected = true;
dlgMain.panel1.stxtUnit.text = "word";
}
if (dlgMain.panel1.ddLeft.selection.text == "Title") {
dlgMain.panel1.ddLogic.add ( "item", 'Is' ).value = '==';
dlgMain.panel1.ddLogic.add ( "item", 'Is Not' ).value = '!=';
dlgMain.panel1.ddLogic.add ( "item", 'Contains' );
dlgMain.panel1.ddLogic.add ( "item", 'Does Not Contain' );
dlgMain.panel1.ddLogic.items[0].selected = true;
dlgMain.panel1.ddRight.add ( "item", 'Value..' );
dlgMain.panel1.ddRight.items[0].selected = true;
dlgMain.panel1.stxtUnit.text = "word";
}
} // end ddLeft.OnChange
dlgMain.panel1.ddRight.onChange = function (){
if (dlgMain.panel1.ddRight.selection.text == "Value..") {
dlgMain.panel1.txtInputValue.text ='';
dlgMain.panel1.txtInputValue.enabled = true;
}
else {
dlgMain.panel1.txtInputValue.text ='';
dlgMain.panel1.txtInputValue.enabled = false;
}
}
//population of ActionSets and Actions begins here..
InitDialog();
this.actionInfo = GetActionSetInfo();
if ( this.actionInfo.length > 0 ) {
for ( var i = 0; i < this.actionInfo.length; i++ ) {
this.dlgMain.panel1.ddSet.add( "item", this.actionInfo[i].name );
}
this.dlgMain.panel1.ddSet.items[0].selected = true;
this.dlgMain.panel1.ddSet.onChange = function( forcedSelectionIndex ) {
var index = 0;
var d = FindDialog( this );
dlgMain.panel1.ddAction.removeAll();
if ( undefined == forcedSelectionIndex ) {
forcedSelectionIndex = dlgMain.panel1.ddSet.selection.index;
if ( undefined != d.ip.actionIndex ) {
index = d.ip.actionIndex;
d.ip.actionIndex = undefined;
}
}
for ( var i = 0; i < d.ip.actionInfo[ forcedSelectionIndex ].children.length; i++ ) {
dlgMain.panel1.ddAction.add( "item", d.ip.actionInfo[ forcedSelectionIndex ].children[ i ].name );
}
if ( dlgMain.panel1.ddAction.items.length > 0 ) {
dlgMain.panel1.ddAction.items[ index ].selected = true;
}
if ( null != this.selection ) {
this.helpTip = this.selection.text;
}
}
}
else {
}
this.dlgMain.panel1.ddAction.onChange = function() {
}
///////////////////////////////////////////////////////////////////////////////
// Function: GetActionSetInfo
// Usage: walk all the items in the action palette and record the action set
// names and all the action children
// Input: <none>
// Return: the array of all the ActionData
// Note: This will throw an error during a normal execution. There is a bug
// in Photoshop that makes it impossible to get an acurate count of the number
// of action sets.
///////////////////////////////////////////////////////////////////////////////
function GetActionSetInfo() {
var actionSetInfo = new Array();
var setCounter = 1;
while ( true ) {
var ref = new ActionReference();
ref.putIndex( gClassActionSet, setCounter );
var desc = undefined;
try { desc = executeActionGet( ref ); }
catch( e ) { break; }
var actionData = new ActionData();
if ( desc.hasKey( gKeyName ) ) {
actionData.name = desc.getString( gKeyName );
}
var numberChildren = 0;
if ( desc.hasKey( gKeyNumberOfChildren ) ) {
numberChildren = desc.getInteger( gKeyNumberOfChildren );
}
if ( numberChildren ) {
actionData.children = GetActionInfo( setCounter, numberChildren );
actionSetInfo.push( actionData );
}
setCounter++;
}
return actionSetInfo;
}
///////////////////////////////////////////////////////////////////////////////
// Function: GetActionInfo
// Usage: used when walking through all the actions in the action set
// Input: action set index, number of actions in this action set
// Return: true or false, true if file or folder is to be displayed
///////////////////////////////////////////////////////////////////////////////
function GetActionInfo( setIndex, numChildren ) {
var actionInfo = new Array();
for ( var i = 1; i <= numChildren; i++ ) {
var ref = new ActionReference();
ref.putIndex( gClassAction, i );
ref.putIndex( gClassActionSet, setIndex );
var desc = undefined;
desc = executeActionGet( ref );
var actionData = new ActionData();
if ( desc.hasKey( gKeyName ) ) {
actionData.name = desc.getString( gKeyName );
}
var numberChildren = 0;
if ( desc.hasKey( gKeyNumberOfChildren ) ) {
numberChildren = desc.getInteger( gKeyNumberOfChildren );
}
actionInfo.push( actionData );
}
return actionInfo;
}
///////////////////////////////////////////////////////////////////////////////
// Function: ActionData
// Usage: this could be an action set or an action
// Input: <none>
// Return: a new Object of ActionData
///////////////////////////////////////////////////////////////////////////////
function ActionData() {
this.name = "";
this.children = undefined;
this.toString = function () {
var strTemp = this.name;
if ( undefined != this.children ) {
for ( var i = 0; i < this.children.length; i++ ) {
strTemp += " " + this.children[i].toString();
}
}
return strTemp;
}
}
function FindDialog( inItem ) {
var w = inItem;
while ( 'dialog' != w.type ) {
if ( undefined == w.parent ) {
w = null;
break;
}
w = w.parent;
}
return w;
}
this.dlgMain.SetDropDown = function ( dd, strSet ) {
var index = 0;
for ( var i = 0; i < dd.items.length; i++ ) {
if ( dd.items[ i ].toString() == strSet ) {
index = i;
break;
}
}
if ( dd.items.length > 0 ) {
dd.items[ index ].selected = true;
}
return index;
}
function InitDialog () {
var d = this.dlgMain;
var p = this.params;
this.dlgMain.ip = this;
d.loadFromDisk = true;
}
/////////////////////////
InitDialog();
this.actionInfo = GetActionSetInfo();
if ( this.actionInfo.length > 0 ) {
for ( var i = 0; i < this.actionInfo.length; i++ ) {
this.dlgMain.panel1.ddSetElse.add( "item", this.actionInfo[i].name );
}
this.dlgMain.panel1.ddSetElse.items[0].selected = true;
this.dlgMain.panel1.ddSetElse.onChange = function( forcedSelectionIndex ) {
var index = 0;
var d = FindDialog( this );
dlgMain.panel1.ddActionElse.removeAll();
if ( undefined == forcedSelectionIndex ) {
forcedSelectionIndex = dlgMain.panel1.ddSetElse.selection.index;
if ( undefined != d.ip.actionIndex ) {
index = d.ip.actionIndex;
d.ip.actionIndex = undefined;
}
}
for ( var i = 0; i < d.ip.actionInfo[ forcedSelectionIndex ].children.length; i++ ) {
dlgMain.panel1.ddActionElse.add( "item", d.ip.actionInfo[ forcedSelectionIndex ].children[ i ].name );
}
if ( dlgMain.panel1.ddActionElse.items.length > 0 ) {
dlgMain.panel1.ddActionElse.items[ index ].selected = true;
}
if ( null != this.selection ) {
this.helpTip = this.selection.text;
}
}
}
else {
}
this.dlgMain.panel1.ddActionElse.onChange = function() {
}
dlgMain.panel1.ddThen.onChange = function (){
if (dlgMain.panel1.ddThen.selection.text == "Do Nothing") {
dlgMain.panel1.ddSet.enabled = false;
dlgMain.panel1.ddAction.enabled = false;
}
else {
dlgMain.panel1.ddSet.enabled = true;
dlgMain.panel1.ddAction.enabled = true;
}
}
dlgMain.panel1.ddElse.onChange = function (){
if (dlgMain.panel1.ddElse.selection.text == "Do Nothing") {
dlgMain.panel1.ddSetElse.enabled = false;
dlgMain.panel1.ddActionElse.enabled = false;
}
else {
dlgMain.panel1.ddSetElse.enabled = true;
dlgMain.panel1.ddActionElse.enabled = true;
}
}
this.dlgMain.btnCancel.onClick = function (){
gCancel = true;
dlgMain.close();
}
this.dlgMain.panel0.btnSelectFolder.onClick = function (){
gFolder = Folder.selectDialog("Select the Images Source Folder");
dlgMain.panel0.stxtFolderPath.text = gFolder.fsName;
}
// Start RUN button
this.dlgMain.btnRun.onClick = function (){
gCancel = false;
dlgMain.close();
}// End RUN button
dlgMain.show();
// *************************
function genvars () {
if (app.documents.length != 0) {
if (dlgMain.panel1.ddLeft.selection.text == "Format") {
var lastDot = activeDocument.name.toString().lastIndexOf( "." );
var strLength = activeDocument.name.toString().length;
var extension = activeDocument.name.toString().substr( lastDot + 1, strLength - lastDot );
extension = extension.toUpperCase();
if (extension == 'JPEG') {
extension = 'JPG';
}
if (extension == 'TIFF') {
extension = 'TIF';
}
gLeft = extension;
gtoskip = true;
}
if (dlgMain.panel1.ddLeft.selection.text == "Height")
{
gLeft = activeDocument.height;
gtoskip = true;
}
if (dlgMain.panel1.ddLeft.selection.text == "Width")
{
gLeft = activeDocument.width;
gtoskip = true;
}
if (dlgMain.panel1.ddLeft.selection.text == "File Size (KB)")
{
gLeft = Math.round(activeDocument.fullName.length/1024);
gtoskip = false;
}
if (dlgMain.panel1.ddLeft.selection.text == "File Name - without extension")
{
gLeft = activeDocument.name.substring(0,activeDocument.name.lastIndexOf('.'));
gLeft = gLeft.toUpperCase();
gtoskip = true;
}
if (dlgMain.panel1.ddLeft.selection.text == "File Name - with extension")
{
gLeft = activeDocument.name;
gLeft = gLeft.toUpperCase();
gtoskip = true;
}
if (dlgMain.panel1.ddLeft.selection.text == "Resolution")
{
gLeft = activeDocument.resolution;
gtoskip = false;
}
if (dlgMain.panel1.ddLeft.selection.text == "Color Mode")
{
gLeft = activeDocument.mode;
gtoskip = false;
}
if (dlgMain.panel1.ddLeft.selection.text == "Color Profile Name")
{
if (activeDocument.colorProfileType != ColorProfile.NONE) {
gLeft = activeDocument.colorProfileName;
}
else {
gLeft = "O";
}
gtoskip = true;
}
if (dlgMain.panel1.ddLeft.selection.text == "Color Profile Type")
{
gLeft = activeDocument.colorProfileType;
gtoskip = false;
}
if (dlgMain.panel1.ddLeft.selection.text == "Bits per Channel")
{
gLeft = activeDocument.bitsPerChannel;
gtoskip = false;
}
if (dlgMain.panel1.ddLeft.selection.text == "Pixel Aspect Ratio")
{
gLeft = activeDocument.pixelAspectRatio;
gtoskip = false;
}
if (dlgMain.panel1.ddLeft.selection.text == "Author")
{
gLeft = activeDocument.info.author;
gLeft = gLeft.toUpperCase();
gtoskip = true;
}
if (dlgMain.panel1.ddLeft.selection.text == "Caption")
{
gLeft = activeDocument.info.caption;
gLeft = gLeft.toUpperCase();
gtoskip = true;
}
if (dlgMain.panel1.ddLeft.selection.text == "Category")
{
gLeft = activeDocument.info.category;
gLeft = gLeft.toUpperCase();
gtoskip = true;
}
if (dlgMain.panel1.ddLeft.selection.text == "Copyright Type")
{
gLeft = activeDocument.info.copyrighted;
gtoskip = false;
}
if (dlgMain.panel1.ddLeft.selection.text == "Copyright Notice")
{
gLeft = activeDocument.info.copyrightNotice;
gLeft = gLeft.toUpperCase();
gtoskip = true;
}
if (dlgMain.panel1.ddLeft.selection.text == "Country")
{
gLeft = activeDocument.info.country;
gLeft = gLeft.toUpperCase();
gtoskip = true;
}
if (dlgMain.panel1.ddLeft.selection.text == "Exif")
{
gLeft = activeDocument.info.exif.toString();
gLeft = gLeft.toUpperCase();
gtoskip = true;
}
if (dlgMain.panel1.ddLeft.selection.text == "Keywords")
{
gLeft = activeDocument.info.keywords;
gLeft = gLeft.toUpperCase();
gtoskip = true;
}
if (dlgMain.panel1.ddLeft.selection.text == "Title")
{
gLeft = activeDocument.info.title;
gLeft = gLeft.toUpperCase();
gtoskip = true;
}
// ----------------------------- end setting gLeft
// ----------------------------- begin setting gRight
if (dlgMain.panel1.ddLeft.selection.text == "Format")
{
gRight = dlgMain.panel1.ddRight.selection.value;
if (dlgMain.panel1.ddLogic.selection.text == "Is") {
gTruth = (gLeft == gRight);
}
if (dlgMain.panel1.ddLogic.selection.text == "Is Not") {
gTruth = (gLeft != gRight);
}
gtoskip = true;
} // end Format
if (dlgMain.panel1.ddLeft.selection.text == "Height"){
if (dlgMain.panel1.ddRight.selection.text == "Width")
{
gRight = activeDocument.width;
}
else {
gRight = dlgMain.panel1.txtInputValue.text;
}
if (dlgMain.panel1.ddLogic.selection.text == "Equals") {
gTruth = (gLeft == gRight);
gtoskip = true;
}
if (dlgMain.panel1.ddLogic.selection.text == "Is Greater Than") {
gTruth = (gLeft > gRight);
gtoskip = true;
}
if (dlgMain.panel1.ddLogic.selection.text == "Is Lesser Than") {
gTruth = (gLeft < gRight);
gtoskip = true;
}
if (dlgMain.panel1.ddLogic.selection.text == "Is Equals or Greater Than") {
gTruth = (gLeft >= gRight);
gtoskip = true;
}
if (dlgMain.panel1.ddLogic.selection.text == "Is Equals or Lesser Than") {
gTruth = (gLeft <= gRight);
gtoskip = true;
}
if (dlgMain.panel1.ddLogic.selection.text == "Does Not Equal") {
gTruth = (gLeft != gRight);
gtoskip = true;
}
}// end Height
if (dlgMain.panel1.ddLeft.selection.text == "Width"){
if (dlgMain.panel1.ddRight.selection.text == "Height")
{
gRight = activeDocument.height;
}
else {
gRight = dlgMain.panel1.txtInputValue.text;
}
if (dlgMain.panel1.ddLogic.selection.text == "Equals") {
gTruth = (gLeft == gRight);
gtoskip = true;
}
if (dlgMain.panel1.ddLogic.selection.text == "Is Greater Than") {
gTruth = (gLeft > gRight);
gtoskip = true;
}
if (dlgMain.panel1.ddLogic.selection.text == "Is Lesser Than") {
gTruth = (gLeft < gRight);
gtoskip = true;
}
if (dlgMain.panel1.ddLogic.selection.text == "Is Equals or Greater Than") {
gTruth = (gLeft >= gRight);
gtoskip = true;
}
if (dlgMain.panel1.ddLogic.selection.text == "Is Equals or Lesser Than") {
gTruth = (gLeft <= gRight);
gtoskip = true;
}
if (dlgMain.panel1.ddLogic.selection.text == "Does Not Equal") {
gTruth = (gLeft != gRight);
gtoskip = true;
}
}// end Width
if (dlgMain.panel1.ddLeft.selection.text == "File Size (KB)"){
gRight =dlgMain.panel1.txtInputValue.text;
gtoskip = false;
}// end File Size
if (dlgMain.panel1.ddLeft.selection.text == "File Name - without extension") {
gRight =dlgMain.panel1.txtInputValue.text;
gRight = gRight.toUpperCase();
if (dlgMain.panel1.ddLogic.selection.text == "Is") {
gTruth = (gLeft == gRight);
}
if (dlgMain.panel1.ddLogic.selection.text == "Is Not") {
gTruth = (gLeft != gRight);
}
if (dlgMain.panel1.ddLogic.selection.text == "Contains") {
gTruth = (gLeft.match(gRight));
}
if (dlgMain.panel1.ddLogic.selection.text == "Does Not Contain") {
gTruth = (!(gLeft.match(gRight)));
}
gtoskip = true;
} // end File Name - without extension
if (dlgMain.panel1.ddLeft.selection.text == "File Name - with extension") {
gRight =dlgMain.panel1.txtInputValue.text;
gRight = gRight.toUpperCase();
if (dlgMain.panel1.ddLogic.selection.text == "Is") {
gTruth = (gLeft == gRight);
}
if (dlgMain.panel1.ddLogic.selection.text == "Is Not") {
gTruth = (gLeft != gRight);
}
if (dlgMain.panel1.ddLogic.selection.text == "Contains") {
gTruth = (gLeft.match(gRight));
}
if (dlgMain.panel1.ddLogic.selection.text == "Does Not Contain") {
gTruth = (!(gLeft.match(gRight)));
}
gtoskip = true;
} // end File Name - with Extension
if (dlgMain.panel1.ddLeft.selection.text == "Resolution") {
gRight =dlgMain.panel1.txtInputValue.text;
gtoskip = false;
} // end Resolution
if (dlgMain.panel1.ddLeft.selection.text == "Color Mode") {
gRight = dlgMain.panel1.ddRight.selection.value;
gtoskip = false;
}// end Color Mode
if (dlgMain.panel1.ddLeft.selection.text == "Color Profile Name") {
if (activeDocument.colorProfileType != ColorProfile.NONE) {
gRight = dlgMain.panel1.ddRight.selection.value;
}
else {
gRight = "image does not have color profile";
}
if (dlgMain.panel1.ddLogic.selection.text == "Is") {
gTruth = (gLeft == gRight);
}
if (dlgMain.panel1.ddLogic.selection.text == "Is Not") {
gTruth = (gLeft != gRight);
}
// alert (gRight);
gtoskip = true;
}// end Color Profile Name
if (dlgMain.panel1.ddLeft.selection.text == "Color Profile Type") {
gRight = dlgMain.panel1.ddRight.selection.value;
gtoskip = false;
}// end Color Profile Type
if (dlgMain.panel1.ddLeft.selection.text == "Bits per Channel") {
gRight = dlgMain.panel1.ddRight.selection.value;
gtoskip = false;
}// end Bits Per Channel
if (dlgMain.panel1.ddLeft.selection.text == "Pixel Aspect Ratio") {
gRight = dlgMain.panel1.ddRight.selection.value;
gtoskip = false;
}// end Pixel Aspect Ratio
if (dlgMain.panel1.ddLeft.selection.text == "Author") {
gRight =dlgMain.panel1.txtInputValue.text;
gRight = gRight.toUpperCase();
if (dlgMain.panel1.ddLogic.selection.text == "Is") {
gTruth = (gLeft == gRight);
}
if (dlgMain.panel1.ddLogic.selection.text == "Is Not") {
gTruth = (gLeft != gRight);
}
if (dlgMain.panel1.ddLogic.selection.text == "Contains") {
gTruth = (gLeft.match(gRight));
}
if (dlgMain.panel1.ddLogic.selection.text == "Does Not Contain") {
gTruth = (!(gLeft.match(gRight)));
}
gtoskip = true;
} // end File Name - Author
if (dlgMain.panel1.ddLeft.selection.text == "Caption") {
gRight =dlgMain.panel1.txtInputValue.text;
gRight = gRight.toUpperCase();
if (dlgMain.panel1.ddLogic.selection.text == "Is") {
gTruth = (gLeft == gRight);
}
if (dlgMain.panel1.ddLogic.selection.text == "Is Not") {
gTruth = (gLeft != gRight);
}
if (dlgMain.panel1.ddLogic.selection.text == "Contains") {
gTruth = (gLeft.match(gRight));
}
if (dlgMain.panel1.ddLogic.selection.text == "Does Not Contain") {
gTruth = (!(gLeft.match(gRight)));
}
gtoskip = true;
} // end File Name - Caption
if (dlgMain.panel1.ddLeft.selection.text == "Category") {
gRight =dlgMain.panel1.txtInputValue.text;
gRight = gRight.toUpperCase();
if (dlgMain.panel1.ddLogic.selection.text == "Is") {
gTruth = (gLeft == gRight);
}
if (dlgMain.panel1.ddLogic.selection.text == "Is Not") {
gTruth = (gLeft != gRight);
}
if (dlgMain.panel1.ddLogic.selection.text == "Contains") {
gTruth = (gLeft.match(gRight));
}
if (dlgMain.panel1.ddLogic.selection.text == "Does Not Contain") {
gTruth = (!(gLeft.match(gRight)));
}
gtoskip = true;
} // end Category
if (dlgMain.panel1.ddLeft.selection.text == "Copyright Notice") {
gRight =dlgMain.panel1.txtInputValue.text;
gRight = gRight.toUpperCase();
if (dlgMain.panel1.ddLogic.selection.text == "Is") {
gTruth = (gLeft == gRight);
}
if (dlgMain.panel1.ddLogic.selection.text == "Is Not") {
gTruth = (gLeft != gRight);
}
if (dlgMain.panel1.ddLogic.selection.text == "Contains") {
gTruth = (gLeft.match(gRight));
}
if (dlgMain.panel1.ddLogic.selection.text == "Does Not Contain") {
gTruth = (!(gLeft.match(gRight)));
}
gtoskip = true;
} // end Copyright Notice
if (dlgMain.panel1.ddLeft.selection.text == "Country") {
gRight =dlgMain.panel1.txtInputValue.text;
gRight = gRight.toUpperCase();
if (dlgMain.panel1.ddLogic.selection.text == "Is") {
gTruth = (gLeft == gRight);
}
if (dlgMain.panel1.ddLogic.selection.text == "Is Not") {
gTruth = (gLeft != gRight);
}
if (dlgMain.panel1.ddLogic.selection.text == "Contains") {
gTruth = (gLeft.match(gRight));
}
if (dlgMain.panel1.ddLogic.selection.text == "Does Not Contain") {
gTruth = (!(gLeft.match(gRight)));
}
gtoskip = true;
} // end Country
if (dlgMain.panel1.ddLeft.selection.text == "Exif") {
gRight =dlgMain.panel1.txtInputValue.text;
gRight = gRight.toUpperCase();
if (dlgMain.panel1.ddLogic.selection.text == "Is") {
gTruth = (gLeft == gRight);
}
if (dlgMain.panel1.ddLogic.selection.text == "Is Not") {
gTruth = (gLeft != gRight);
}
if (dlgMain.panel1.ddLogic.selection.text == "Contains") {
gTruth = (gLeft.match(gRight));
}
if (dlgMain.panel1.ddLogic.selection.text == "Does Not Contain") {
gTruth = (!(gLeft.match(gRight)));
}
gtoskip = true;
} // end Exif
if (dlgMain.panel1.ddLeft.selection.text == "Keywords") {
gRight =dlgMain.panel1.txtInputValue.text;
gRight = gRight.toUpperCase();
if (dlgMain.panel1.ddLogic.selection.text == "Is") {
gTruth = (gLeft == gRight);
}
if (dlgMain.panel1.ddLogic.selection.text == "Is Not") {
gTruth = (gLeft != gRight);
}
if (dlgMain.panel1.ddLogic.selection.text == "Contains") {
gTruth = (gLeft.match(gRight));
}
if (dlgMain.panel1.ddLogic.selection.text == "Does Not Contain") {
gTruth = (!(gLeft.match(gRight)));
}
gtoskip = true;
} // end Keywords
if (dlgMain.panel1.ddLeft.selection.text == "Title") {
gRight =dlgMain.panel1.txtInputValue.text;
gRight = gRight.toUpperCase();
if (dlgMain.panel1.ddLogic.selection.text == "Is") {
gTruth = (gLeft == gRight);
}
if (dlgMain.panel1.ddLogic.selection.text == "Is Not") {
gTruth = (gLeft != gRight);
}
if (dlgMain.panel1.ddLogic.selection.text == "Contains") {
gTruth = (gLeft.match(gRight));
}
if (dlgMain.panel1.ddLogic.selection.text == "Does Not Contain") {
gTruth = (!(gLeft.match(gRight)));
}
gtoskip = true;
} // end Title
if (dlgMain.panel1.ddLeft.selection.text == "Copyright Type") {
gRight = dlgMain.panel1.ddRight.selection.value;
gtoskip = false;
} // end Copyright Type
// ----------------------------- end setting gRight
// ----------------------------- begin setting gLogic
if (dlgMain.panel1.ddLogic.selection.value != undefined){
gLogic = dlgMain.panel1.ddLogic.selection.value;
} // end if (dlgMain.panel1.ddLogic.selection.value != undefined)
else {
if (dlgMain.panel1.ddLogic.selection.text == "Contains") {
}
if (dlgMain.panel1.ddLogic.selection.text == "Does Not Contain") {
}
}// end else
// ----------------------------- end setting gLogic
//gcondition = gLeft + gLogic + gRight;
}// end if (app.documents.length == 0) {
} // End genvars
// *************************
function genvars1 () {
if (app.documents.length != 0) {
if (dlgMain.panel1.ddLeft.selection.text == "Format") {
var lastDot = docRef.name.toString().lastIndexOf( "." );
var strLength = docRef.name.toString().length;
var extension = docRef.name.toString().substr( lastDot + 1, strLength - lastDot );
extension = extension.toUpperCase();
if (extension == 'JPEG') {
extension = 'JPG';
}
if (extension == 'TIFF') {
extension = 'TIF';
}
gLeft = extension;
gtoskip = true;
}
if (dlgMain.panel1.ddLeft.selection.text == "Height")
{
gLeft = docRef.height;
gtoskip = true;
}
if (dlgMain.panel1.ddLeft.selection.text == "Width")
{
gLeft = docRef.width;
gtoskip = true;
}
if (dlgMain.panel1.ddLeft.selection.text == "File Size (KB)")
{
gLeft = Math.round(docRef.fullName.length/1024);
gtoskip = false;
}
if (dlgMain.panel1.ddLeft.selection.text == "File Name - without extension")
{
gLeft = docRef.name.substring(0,docRef.name.lastIndexOf('.'));
gLeft = gLeft.toUpperCase();
gtoskip = true;
}
if (dlgMain.panel1.ddLeft.selection.text == "File Name - with extension")
{
gLeft = docRef.name;
gLeft = gLeft.toUpperCase();
gtoskip = true;
}
if (dlgMain.panel1.ddLeft.selection.text == "Resolution")
{
gLeft = docRef.resolution;
gtoskip = false;
}
if (dlgMain.panel1.ddLeft.selection.text == "Color Mode")
{
gLeft = docRef.mode;
gtoskip = false;
}
if (dlgMain.panel1.ddLeft.selection.text == "Color Profile Name")
{
if (docRef.colorProfileType != ColorProfile.NONE) {
gLeft = docRef.colorProfileName;
}
else {
gLeft = "O";
}
gtoskip = true;
}
if (dlgMain.panel1.ddLeft.selection.text == "Color Profile Type")
{
gLeft = docRef.colorProfileType;
gtoskip = false;
}
if (dlgMain.panel1.ddLeft.selection.text == "Bits per Channel")
{
gLeft = docRef.bitsPerChannel;
gtoskip = false;
}
if (dlgMain.panel1.ddLeft.selection.text == "Pixel Aspect Ratio")
{
gLeft = docRef.pixelAspectRatio;
gtoskip = false;
}
if (dlgMain.panel1.ddLeft.selection.text == "Author")
{
gLeft = docRef.info.author;
gLeft = gLeft.toUpperCase();
gtoskip = true;
}
if (dlgMain.panel1.ddLeft.selection.text == "Caption")
{
gLeft = docRef.info.caption;
gLeft = gLeft.toUpperCase();
gtoskip = true;
}
if (dlgMain.panel1.ddLeft.selection.text == "Category")
{
gLeft = docRef.info.category;
gLeft = gLeft.toUpperCase();
gtoskip = true;
}
if (dlgMain.panel1.ddLeft.selection.text == "Copyright Type")
{
gLeft = docRef.info.copyrighted;
gtoskip = false;
}
if (dlgMain.panel1.ddLeft.selection.text == "Copyright Notice")
{
gLeft = docRef.info.copyrightNotice;
gLeft = gLeft.toUpperCase();
gtoskip = true;
}
if (dlgMain.panel1.ddLeft.selection.text == "Country")
{
gLeft = docRef.info.country;
gLeft = gLeft.toUpperCase();
gtoskip = true;
}
if (dlgMain.panel1.ddLeft.selection.text == "Exif")
{
gLeft = docRef.info.exif.toString();
gLeft = gLeft.toUpperCase();
gtoskip = true;
}
if (dlgMain.panel1.ddLeft.selection.text == "Keywords")
{
gLeft = docRef.info.keywords;
gLeft = gLeft.toUpperCase();
gtoskip = true;
}
if (dlgMain.panel1.ddLeft.selection.text == "Title")
{
gLeft = docRef.info.title;
gLeft = gLeft.toUpperCase();
gtoskip = true;
}
// ----------------------------- end setting gLeft
// ----------------------------- begin setting gRight
if (dlgMain.panel1.ddLeft.selection.text == "Format")
{
gRight = dlgMain.panel1.ddRight.selection.value;
if (dlgMain.panel1.ddLogic.selection.text == "Is") {
gTruth = (gLeft == gRight);
}
if (dlgMain.panel1.ddLogic.selection.text == "Is Not") {
gTruth = (gLeft != gRight);
}
gtoskip = true;
} // end Format
if (dlgMain.panel1.ddLeft.selection.text == "Height"){
if (dlgMain.panel1.ddRight.selection.text == "Width")
{
gRight = docRef.width;
}
else {
gRight = dlgMain.panel1.txtInputValue.text;
}
if (dlgMain.panel1.ddLogic.selection.text == "Equals") {
gTruth = (gLeft == gRight);
gtoskip = true;
}
if (dlgMain.panel1.ddLogic.selection.text == "Is Greater Than") {
gTruth = (gLeft > gRight);
gtoskip = true;
}
if (dlgMain.panel1.ddLogic.selection.text == "Is Lesser Than") {
gTruth = (gLeft < gRight);
gtoskip = true;
}
if (dlgMain.panel1.ddLogic.selection.text == "Is Equals or Greater Than") {
gTruth = (gLeft >= gRight);
gtoskip = true;
}
if (dlgMain.panel1.ddLogic.selection.text == "Is Equals or Lesser Than") {
gTruth = (gLeft <= gRight);
gtoskip = true;
}
if (dlgMain.panel1.ddLogic.selection.text == "Does Not Equal") {
gTruth = (gLeft != gRight);
gtoskip = true;
}
}// end Height
if (dlgMain.panel1.ddLeft.selection.text == "Width"){
if (dlgMain.panel1.ddRight.selection.text == "Height")
{
gRight = docRef.height;
}
else {
gRight = dlgMain.panel1.txtInputValue.text;
}
if (dlgMain.panel1.ddLogic.selection.text == "Equals") {
gTruth = (gLeft == gRight);
gtoskip = true;
}
if (dlgMain.panel1.ddLogic.selection.text == "Is Greater Than") {
gTruth = (gLeft > gRight);
gtoskip = true;
}
if (dlgMain.panel1.ddLogic.selection.text == "Is Lesser Than") {
gTruth = (gLeft < gRight);
gtoskip = true;
}
if (dlgMain.panel1.ddLogic.selection.text == "Is Equals or Greater Than") {
gTruth = (gLeft >= gRight);
gtoskip = true;
}
if (dlgMain.panel1.ddLogic.selection.text == "Is Equals or Lesser Than") {
gTruth = (gLeft <= gRight);
gtoskip = true;
}
if (dlgMain.panel1.ddLogic.selection.text == "Does Not Equal") {
gTruth = (gLeft != gRight);
gtoskip = true;
}
}// end Width
if (dlgMain.panel1.ddLeft.selection.text == "File Size (KB)"){
gRight =dlgMain.panel1.txtInputValue.text;
gtoskip = false;
}// end File Size
if (dlgMain.panel1.ddLeft.selection.text == "File Name - without extension") {
gRight =dlgMain.panel1.txtInputValue.text;
gRight = gRight.toUpperCase();
if (dlgMain.panel1.ddLogic.selection.text == "Is") {
gTruth = (gLeft == gRight);
}
if (dlgMain.panel1.ddLogic.selection.text == "Is Not") {
gTruth = (gLeft != gRight);
}
if (dlgMain.panel1.ddLogic.selection.text == "Contains") {
gTruth = (gLeft.match(gRight));
}
if (dlgMain.panel1.ddLogic.selection.text == "Does Not Contain") {
gTruth = (!(gLeft.match(gRight)));
}
gtoskip = true;
} // end File Name - without extension
if (dlgMain.panel1.ddLeft.selection.text == "File Name - with extension") {
gRight =dlgMain.panel1.txtInputValue.text;
gRight = gRight.toUpperCase();
if (dlgMain.panel1.ddLogic.selection.text == "Is") {
gTruth = (gLeft == gRight);
}
if (dlgMain.panel1.ddLogic.selection.text == "Is Not") {
gTruth = (gLeft != gRight);
}
if (dlgMain.panel1.ddLogic.selection.text == "Contains") {
gTruth = (gLeft.match(gRight));
}
if (dlgMain.panel1.ddLogic.selection.text == "Does Not Contain") {
gTruth = (!(gLeft.match(gRight)));
}
gtoskip = true;
} // end File Name - with Extension
if (dlgMain.panel1.ddLeft.selection.text == "Resolution") {
gRight =dlgMain.panel1.txtInputValue.text;
gtoskip = false;
} // end Resolution
if (dlgMain.panel1.ddLeft.selection.text == "Color Mode") {
gRight = dlgMain.panel1.ddRight.selection.value;
gtoskip = false;
}// end Color Mode
if (dlgMain.panel1.ddLeft.selection.text == "Color Profile Name") {
if (docRef.colorProfileType != ColorProfile.NONE) {
gRight = dlgMain.panel1.ddRight.selection.value;
}
else {
gRight = "image does not have color profile";
}
if (dlgMain.panel1.ddLogic.selection.text == "Is") {
gTruth = (gLeft == gRight);
}
if (dlgMain.panel1.ddLogic.selection.text == "Is Not") {
gTruth = (gLeft != gRight);
}
// alert (gRight);
gtoskip = true;
}// end Color Profile Name
if (dlgMain.panel1.ddLeft.selection.text == "Color Profile Type") {
gRight = dlgMain.panel1.ddRight.selection.value;
gtoskip = false;
}// end Color Profile Type
if (dlgMain.panel1.ddLeft.selection.text == "Bits per Channel") {
gRight = dlgMain.panel1.ddRight.selection.value;
gtoskip = false;
}// end Bits Per Channel
if (dlgMain.panel1.ddLeft.selection.text == "Pixel Aspect Ratio") {
gRight = dlgMain.panel1.ddRight.selection.value;
gtoskip = false;
}// end Pixel Aspect Ratio
if (dlgMain.panel1.ddLeft.selection.text == "Author") {
gRight =dlgMain.panel1.txtInputValue.text;
gRight = gRight.toUpperCase();
if (dlgMain.panel1.ddLogic.selection.text == "Is") {
gTruth = (gLeft == gRight);
}
if (dlgMain.panel1.ddLogic.selection.text == "Is Not") {
gTruth = (gLeft != gRight);
}
if (dlgMain.panel1.ddLogic.selection.text == "Contains") {
gTruth = (gLeft.match(gRight));
}
if (dlgMain.panel1.ddLogic.selection.text == "Does Not Contain") {
gTruth = (!(gLeft.match(gRight)));
}
gtoskip = true;
} // end File Name - Author
if (dlgMain.panel1.ddLeft.selection.text == "Caption") {
gRight =dlgMain.panel1.txtInputValue.text;
gRight = gRight.toUpperCase();
if (dlgMain.panel1.ddLogic.selection.text == "Is") {
gTruth = (gLeft == gRight);
}
if (dlgMain.panel1.ddLogic.selection.text == "Is Not") {
gTruth = (gLeft != gRight);
}
if (dlgMain.panel1.ddLogic.selection.text == "Contains") {
gTruth = (gLeft.match(gRight));
}
if (dlgMain.panel1.ddLogic.selection.text == "Does Not Contain") {
gTruth = (!(gLeft.match(gRight)));
}
gtoskip = true;
} // end File Name - Caption
if (dlgMain.panel1.ddLeft.selection.text == "Category") {
gRight =dlgMain.panel1.txtInputValue.text;
gRight = gRight.toUpperCase();
if (dlgMain.panel1.ddLogic.selection.text == "Is") {
gTruth = (gLeft == gRight);
}
if (dlgMain.panel1.ddLogic.selection.text == "Is Not") {
gTruth = (gLeft != gRight);
}
if (dlgMain.panel1.ddLogic.selection.text == "Contains") {
gTruth = (gLeft.match(gRight));
}
if (dlgMain.panel1.ddLogic.selection.text == "Does Not Contain") {
gTruth = (!(gLeft.match(gRight)));
}
gtoskip = true;
} // end Category
if (dlgMain.panel1.ddLeft.selection.text == "Copyright Notice") {
gRight =dlgMain.panel1.txtInputValue.text;
gRight = gRight.toUpperCase();
if (dlgMain.panel1.ddLogic.selection.text == "Is") {
gTruth = (gLeft == gRight);
}
if (dlgMain.panel1.ddLogic.selection.text == "Is Not") {
gTruth = (gLeft != gRight);
}
if (dlgMain.panel1.ddLogic.selection.text == "Contains") {
gTruth = (gLeft.match(gRight));
}
if (dlgMain.panel1.ddLogic.selection.text == "Does Not Contain") {
gTruth = (!(gLeft.match(gRight)));
}
gtoskip = true;
} // end Copyright Notice
if (dlgMain.panel1.ddLeft.selection.text == "Country") {
gRight =dlgMain.panel1.txtInputValue.text;
gRight = gRight.toUpperCase();
if (dlgMain.panel1.ddLogic.selection.text == "Is") {
gTruth = (gLeft == gRight);
}
if (dlgMain.panel1.ddLogic.selection.text == "Is Not") {
gTruth = (gLeft != gRight);
}
if (dlgMain.panel1.ddLogic.selection.text == "Contains") {
gTruth = (gLeft.match(gRight));
}
if (dlgMain.panel1.ddLogic.selection.text == "Does Not Contain") {
gTruth = (!(gLeft.match(gRight)));
}
gtoskip = true;
} // end Country
if (dlgMain.panel1.ddLeft.selection.text == "Exif") {
gRight =dlgMain.panel1.txtInputValue.text;
gRight = gRight.toUpperCase();
if (dlgMain.panel1.ddLogic.selection.text == "Is") {
gTruth = (gLeft == gRight);
}
if (dlgMain.panel1.ddLogic.selection.text == "Is Not") {
gTruth = (gLeft != gRight);
}
if (dlgMain.panel1.ddLogic.selection.text == "Contains") {
gTruth = (gLeft.match(gRight));
}
if (dlgMain.panel1.ddLogic.selection.text == "Does Not Contain") {
gTruth = (!(gLeft.match(gRight)));
}
gtoskip = true;
} // end Exif
if (dlgMain.panel1.ddLeft.selection.text == "Keywords") {
gRight =dlgMain.panel1.txtInputValue.text;
gRight = gRight.toUpperCase();
if (dlgMain.panel1.ddLogic.selection.text == "Is") {
gTruth = (gLeft == gRight);
}
if (dlgMain.panel1.ddLogic.selection.text == "Is Not") {
gTruth = (gLeft != gRight);
}
if (dlgMain.panel1.ddLogic.selection.text == "Contains") {
gTruth = (gLeft.match(gRight));
}
if (dlgMain.panel1.ddLogic.selection.text == "Does Not Contain") {
gTruth = (!(gLeft.match(gRight)));
}
gtoskip = true;
} // end Keywords
if (dlgMain.panel1.ddLeft.selection.text == "Title") {
gRight =dlgMain.panel1.txtInputValue.text;
gRight = gRight.toUpperCase();
if (dlgMain.panel1.ddLogic.selection.text == "Is") {
gTruth = (gLeft == gRight);
}
if (dlgMain.panel1.ddLogic.selection.text == "Is Not") {
gTruth = (gLeft != gRight);
}
if (dlgMain.panel1.ddLogic.selection.text == "Contains") {
gTruth = (gLeft.match(gRight));
}
if (dlgMain.panel1.ddLogic.selection.text == "Does Not Contain") {
gTruth = (!(gLeft.match(gRight)));
}
gtoskip = true;
} // end Title
if (dlgMain.panel1.ddLeft.selection.text == "Copyright Type") {
gRight = dlgMain.panel1.ddRight.selection.value;
gtoskip = false;
} // end Copyright Type
// ----------------------------- end setting gRight
// ----------------------------- begin setting gLogic
if (dlgMain.panel1.ddLogic.selection.value != undefined){
gLogic = dlgMain.panel1.ddLogic.selection.value;
} // end if (dlgMain.panel1.ddLogic.selection.value != undefined)
else {
if (dlgMain.panel1.ddLogic.selection.text == "Contains") {
}
if (dlgMain.panel1.ddLogic.selection.text == "Does Not Contain") {
}
}// end else
// ----------------------------- end setting gLogic
//gcondition = gLeft + gLogic + gRight;
}// end if (app.documents.length == 0) {
} // End genvars1
// *************************
//-----------------
function IsFileOneOfThese( inFileName, inArrayOfFileExtensions ) {
var lastDot = inFileName.toString().lastIndexOf( "." );
if ( lastDot == -1 ) {
return false;
}
var strLength = inFileName.toString().length;
var extension = inFileName.toString().substr( lastDot + 1, strLength - lastDot );
extension = extension.toLowerCase();
for (var i = 0; i < inArrayOfFileExtensions.length; i++ ) {
if ( extension == inArrayOfFileExtensions[i] ) {
return true;
}
}
return false;
}
//--------------
genvars();
if (dlgMain.panel0.rbUseOpenImage.value == true) {
if(!(gCancel)) {
while (app.documents.length) {
docRef = app.activeDocument;
genvars();
if (!(gtoskip)) {
mystr = gLeft + gLogic + gRight;
temp = eval(mystr);
if (temp){
if (dlgMain.panel1.ddThen.selection.text == "Run Action"){
app.displayDialogs = DialogModes.NO;
var strtRulerUnits = preferences.rulerUnits;
preferences.rulerUnits = Units.PIXELS;
var actset = dlgMain.panel1.ddSet.selection.text;
var actiontodo = dlgMain.panel1.ddAction.selection.text;
doAction(actiontodo, actset);
preferences.rulerUnits = strtRulerUnits;
} // if (dlgMain.panel1.ddThen.selection.text == "Run Action"){
} //end if (temp)
else {
if (dlgMain.panel1.ddElse.selection.text == "Run Action"){
app.displayDialogs = DialogModes.NO;
var strtRulerUnits = preferences.rulerUnits;
preferences.rulerUnits = Units.PIXELS;
var actset = dlgMain.panel1.ddSetElse.selection.text;
var actiontodo = dlgMain.panel1.ddActionElse.selection.text;
doAction(actiontodo, actset);
preferences.rulerUnits = strtRulerUnits;
} // end else if (dlgMain.panel1.ddThen.selection.text == "Run Action"){
} //end else if (temp);
gLeft = '';
gLogic = '';
gRight = '';
} // end if !(gtoskip)
else {
if (gTruth){
if (dlgMain.panel1.ddThen.selection.text == "Run Action"){
app.displayDialogs = DialogModes.NO;
var strtRulerUnits = preferences.rulerUnits;
preferences.rulerUnits = Units.PIXELS;
var actset = dlgMain.panel1.ddSet.selection.text;
var actiontodo = dlgMain.panel1.ddAction.selection.text;
doAction(actiontodo, actset);
preferences.rulerUnits = strtRulerUnits;
} // end if (dlgMain.panel1.ddThen.selection.text == "Run Action"){
}
else {
if (dlgMain.panel1.ddElse.selection.text == "Run Action"){
app.displayDialogs = DialogModes.NO;
var strtRulerUnits = preferences.rulerUnits;
preferences.rulerUnits = Units.PIXELS;
var actset = dlgMain.panel1.ddSetElse.selection.text;
var actiontodo = dlgMain.panel1.ddActionElse.selection.text;
doAction(actiontodo, actset);
preferences.rulerUnits = strtRulerUnits;
}// end if (dlgMain.panel1.ddElse.selection.text == "Run Action"){
}
gLeft = '';
gLogic = '';
gRight = '';
}
docRef.close();
} //end while (app.documents.length) {
} //end if(!(gCancel))
}// end if (dlgMain.panel0.rbUseOpenImage.value == true) {
//8888888888
if (dlgMain.panel0.rbSelectFolder.value == true) {
if(!(gCancel)) {
if (gFolder != null) {
var fileList = gFolder.getFiles()
for (var i = 0; i < fileList.length; i++) {
if ( fileList[i] instanceof File && ! fileList[i].hidden && ! IsFileOneOfThese( fileList[i], gFilesToSkip ) ) {
// get a reference to the new document
var docRef = open(fileList[i])
genvars1();
if (!(gtoskip)) {
mystr = gLeft + gLogic + gRight;
temp = eval(mystr);
if (temp){
if (dlgMain.panel1.ddThen.selection.text == "Run Action"){
app.displayDialogs = DialogModes.NO;
var strtRulerUnits = preferences.rulerUnits;
preferences.rulerUnits = Units.PIXELS;
var actset = dlgMain.panel1.ddSet.selection.text;
var actiontodo = dlgMain.panel1.ddAction.selection.text;
doAction(actiontodo, actset);
preferences.rulerUnits = strtRulerUnits;
} //end if (dlgMain.panel1.ddThen.selection.text == "Run Action"){
} //end if (temp)
else {
if (dlgMain.panel1.ddElse.selection.text == "Run Action"){
app.displayDialogs = DialogModes.NO;
var strtRulerUnits = preferences.rulerUnits;
preferences.rulerUnits = Units.PIXELS;
var actset = dlgMain.panel1.ddSetElse.selection.text;
var actiontodo = dlgMain.panel1.ddActionElse.selection.text;
doAction(actiontodo, actset);
preferences.rulerUnits = strtRulerUnits;
} // end else if (dlgMain.panel1.ddThen.selection.text == "Run Action"){
} //end else if (temp);
gLeft = '';
gLogic = '';
gRight = '';
} // end if !(gtoskip)
else {
if (gTruth){
if (dlgMain.panel1.ddThen.selection.text == "Run Action"){
app.displayDialogs = DialogModes.NO;
var strtRulerUnits = preferences.rulerUnits;
preferences.rulerUnits = Units.PIXELS;
var actset = dlgMain.panel1.ddSet.selection.text;
var actiontodo = dlgMain.panel1.ddAction.selection.text;
doAction(actiontodo, actset);
preferences.rulerUnits = strtRulerUnits;
} // end if (dlgMain.panel1.ddThen.selection.text == "Run Action"){
}
else {
if (dlgMain.panel1.ddElse.selection.text == "Run Action"){
app.displayDialogs = DialogModes.NO;
var strtRulerUnits = preferences.rulerUnits;
preferences.rulerUnits = Units.PIXELS;
var actset = dlgMain.panel1.ddSetElse.selection.text;
var actiontodo = dlgMain.panel1.ddActionElse.selection.text;
doAction(actiontodo, actset);
preferences.rulerUnits = strtRulerUnits;
}// end if (dlgMain.panel1.ddElse.selection.text == "Run Action"){
}
gLeft = '';
gLogic = '';
gRight = '';
}
docRef.close();
}
} // end for (var i = 0; i < fileList.length; i++) {
}//end if (gFolder != null) {
} //end if(!(gCancel))
}// end if (dlgMain.panel0.rbUSelectFolder.value == true) {
... View more