I recently installed a trial version of PS-CS4 and attempted to run some scripts the I'd written previously for CS3. The scripts runs and completes the process but I get an error message:
"JavaScript code was missing"
Following is the script:
// enable double clicking from the Macintosh Finder or the Windows Explorer
#target photoshop
// in case we double-clicked the file
app.bringToFront();
// capture the unit prefs & change them to pixels
var startRulerUnits = app.preferences.rulerUnits
app.preferences.rulerUnits = Units.PIXELS
// Declare Variables
var doc = app.activeDocument;
var height = doc.height.value;
/////////////////////////////////////////// * MAIN SCRIPT * /////////////////////////////////////////
// Any Action Sets needed for this process must be manually loaded in Photoshop prior to running this Script!!!!
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Determine hieght of document image, choose type of processing, sizing and save image in both PSD and TIFF formats and close document.
// Continue cycle until all open documents have been processed and closed.
while (app.documents.length > 0) {
detHeight ();
savePSD ();
saveFltTiff ();
app.activeDocument.close ();
}
// Close Application, via Script Listener
/*
var idCls = charIDToTypeID( 'Cls ' );
executeAction( idCls, undefined, DialogModes.NO );
*/
//////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////// * DECLARE FUNCTIONS * ///////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////
//Determines amount of scaling if any needed to produce a Letter or Pillar Boxed 2X DV-NTSC image
function detHeight () {
if (height<1068)
app.doAction('DV_NTSC_2X', '01_AE_DV_NTSC_LB_PB_FLAT');
else app.doAction('DV_NTSC_2X', '01_AE_DV_NTSC_LB_PB_FLAT');
}
//Save As PSD, via ScriptListener
function savePSD () {
var id3 = charIDToTypeID( "save" );
var desc2 = new ActionDescriptor();
var id4 = charIDToTypeID( "As " );
var desc3 = new ActionDescriptor();
var id5 = stringIDToTypeID( "maximizeCompatibility" );
desc3.putBoolean( id5, true );
var id6 = charIDToTypeID( "Pht3" );
desc2.putObject( id4, id6, desc3 );
var id7 = charIDToTypeID( "In " );
desc2.putPath( id7, new File( "/Misc/Processed" ) );
var id8 = charIDToTypeID( "LwCs" );
desc2.putBoolean( id8, true );
executeAction( id3, desc2, DialogModes.NO ); }
// Save as Flattened Tiff, via ScriptListener
function saveFltTiff () {
var id6 = charIDToTypeID( "save" );
var desc3 = new ActionDescriptor();
var id7 = charIDToTypeID( "As " );
var desc4 = new ActionDescriptor();
var id8 = charIDToTypeID( "BytO" );
var id9 = charIDToTypeID( "Pltf" );
var id10 = charIDToTypeID( "Mcnt" );
desc4.putEnumerated( id8, id9, id10 );
var id11 = charIDToTypeID( "TIFF" );
desc3.putObject( id7, id11, desc4 );
var id12 = charIDToTypeID( "In " );
desc3.putPath( id12, new File( "/Misc/Processed" ) );
var id13 = charIDToTypeID( "LwCs" );
desc3.putBoolean( id13, true );
var id14 = charIDToTypeID( "Lyrs" );
desc3.putBoolean( id14, false );
executeAction( id6, desc3, DialogModes.NO ); }
//EOF