// enable double clicking from the Macintosh Finder or the Windows Explorer #target photoshop ///////////// // Set-up /// ///////////// // Options for document Color Mode var RGB = "RGBM"; var CMYK = "CMYM"; var Greyscale = "Grys"; // Options for document Background contents var Transparent = "Trns"; var White = "Wht "; var Background = "BckC" // Options for bit depth are 8 and 16 // Options for Pixel Aspect Ration // D1DV NTSC (0.9) // D4D16 Standard (0.95) // D1DV PAL (1.066) // D1DV NTSC Widescreen (1.2) // HDV Anamorphic (1.333) // D1DV PAL Widescreen (1.422) // D4D16 Anamorphic (1.9) // Anamorphic 2:1 (2) // Option for Document Title is a string of your choosing // Options for width, height and resolution in pixels /////////////////////////////// // Call the function makeDoc/// /////////////////////////////// makeDoc("Untitled", 400, 400, 300, Greyscale, 16, White, 0.9); //////////////////////////// // make New Doc Function /// //////////////////////////// function makeDoc(makeDocName, makeDocWidth, makeDocHeight, makeDocRez, makeDocMode, makeDocDepth, makeDocBackground, makeDocAspect) { var id56 = charIDToTypeID( "Mk " ); var desc12 = new ActionDescriptor(); var id57 = charIDToTypeID( "Nw " ); var desc13 = new ActionDescriptor(); var id100 = charIDToTypeID( "Nm " ); desc13.putString( id100, makeDocName ); // Document Name var id58 = charIDToTypeID( "Md " ); var id59 = charIDToTypeID( makeDocMode ); // Color Mode desc13.putClass( id58, id59 ); // Since the doc width and height assume your resolution is 72ppi // adjust the numbers so what you type in for doc width and height // are the numbers you get for doc width and height var rezFix = makeDocRez/72 var id60 = charIDToTypeID( "Wdth" ); var id61 = charIDToTypeID( "#Rlt" ); desc13.putUnitDouble( id60, id61, makeDocWidth/rezFix );// width var id62 = charIDToTypeID( "Hght" ); var id63 = charIDToTypeID( "#Rlt" ); desc13.putUnitDouble( id62, id63, makeDocHeight/rezFix );// height var id64 = charIDToTypeID( "Rslt" ); var id65 = charIDToTypeID( "#Rsl" ); desc13.putUnitDouble( id64, id65, makeDocRez );// resolution var id66 = stringIDToTypeID( "pixelScaleFactor" ); desc13.putDouble( id66, 0.900000 ); // Pixel Aspect Ratio var id67 = charIDToTypeID( "Fl " ); var id68 = charIDToTypeID( "Fl " ); var id69 = charIDToTypeID( makeDocBackground ); // Background Contents desc13.putEnumerated( id67, id68, id69 ); var id70 = charIDToTypeID( "Dpth" ); desc13.putInteger( id70, makeDocDepth ); // Bit Dept var id71 = stringIDToTypeID( "profile" ); // Handle the documents profile based on the Color Mode if (makeDocMode == "RGBM") { // Set your default profile for RGB var makeDocProfile = "sRGB IEC61966-2.1" } if (makeDocMode == "CMYM") { // Set your default profile for CMYK var makeDocProfile = "U.S. Web Coated (SWOP) v2" } if (makeDocMode == "Grys") { // Set your default profile for Greyscale var makeDocProfile = "Dot Gain 20%" } desc13.putString( id71, makeDocProfile ); // Color Profile String var id72 = charIDToTypeID( "Dcmn" ); desc12.putObject( id57, id72, desc13 ); executeAction( id56, desc12, DialogModes.NO ); }