Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Photoshop CS4 "JavaScript code was missing"

New Here ,
Oct 19, 2008 Oct 19, 2008
TOPICS
Actions and scripting
4.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
New Here ,
Oct 19, 2008 Oct 19, 2008
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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 19, 2008 Oct 19, 2008
I found this issue. The problem didn't have anything to do with the script, it was an issue with the action.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 19, 2008 Nov 19, 2008
Scott, I just ran into this same issue. I posted about it in the main Macintosh Photoshop area, but am going to post in here as well as it appears to be an issue with the scripting.

Recently had a very bizarre issue that just happened. Not sure why, but it won't go away.

I use the Fit Image script quite a bit. For sizing images that will end up on the blog, batching out files for proofs, etc. I have it written into many of my actions.

Up until a few days ago, if you opened any action that I've recorded and expanded out the Fit Image step, you would see the dimensions (in pixels) that were recorded. Then, I started getting an error message for any action that used Fit Image. The error message was "Javascript code was missing".

I checked my scripts folder and the Fit Image script is there. Nothing has changed. I even used Time Machine to go back a few weeks and see if anything had been deleted. Nothing.

I tried to write a new action using Fit Image and now, instead of the expanded view showing the size in pixels, it's showing in inches! When I manually use Fit Image, the dialog box comes up with pixels ONLY, so why is it that the recorded step is shown in inches?

I've gone so far as to uninstall CS4 and reinstall it. The first thing I did was record an action and I'm getting the same results. Why would this just change and does this mean I have to re-record all my actions that use Fit Image?

Any ideas or insight?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 19, 2008 Nov 19, 2008
Randy:

If memory serves me correctly, my issue dealt with the fact that all of the action sets I'd recorded were composed in CS3. When I migrated to CS4, the actions were pointing to to an invalid file path. I hope that helps.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 20, 2008 Nov 20, 2008
I spent some time on the phone yesterday talking to tech support. It appears I've discovered a bug with the Fit Image script.

When you use Fit Image, it gives you a dialog box prompting you for dimensions in pixels. After entering those values and recording that step, the recorded step shows up in inches @ 72dpi. This is a bug and it's replicated on both Mac and PC platforms in CS4.

As a consequence, it's also breaking all my previous actions. A temporary solution is to re-record each action that uses the Fit Image step.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 20, 2008 Nov 20, 2008
> When you use Fit Image, it gives you a dialog box prompting you for dimensions in pixels. After entering those values and recording that step, the recorded step shows up in inches @ 72dpi. This is a bug and it's replicated on both Mac and PC platforms in CS4.
>
> As a consequence, it's also breaking all my previous actions. A temporary solution is to re-record each action that uses the Fit Image step.

They also had an off-by-one bug in that script in CS3 (and possibly earlier
versions). You may want to see if that's been fixed. You should be able to
search this forum or ps-scripts.com to find details.

-X
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 20, 2008 Nov 20, 2008
Great suggestion X. Do you know if previous versions of the Fit Image script will work with CS4? Not sure how much of that script changes from one version to the next.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 20, 2008 Nov 20, 2008
randykepple wrote:
> Great suggestion X. Do you know if previous versions of the Fit Image script will work with CS4?

It should. You just have to fix the off-by-one problem which has been addressed
elsewhere.

> Not sure how much of that script changes from one version to the next.

I don't know. I haven't compared the two, but there weren't any changes in PS
that would have required a major rework of that script.

-X
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 20, 2008 Nov 20, 2008
BTW...

I wanted to thank you Xbytor for your Contact Sheet X script. That has really come in handy on MANY occasions. I appreciate you stepping up and putting that out there for the rest of us non-scripting Photoshop users! :)
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 20, 2008 Nov 20, 2008
LATEST
> I wanted to thank you Xbytor for your Contact Sheet X script. That has really come in handy on MANY occasions. I appreciate you stepping up and putting that out there for the rest of us non-scripting Photoshop users! :)

Thanks! New rev (v1.4) coming out today or tomorrow.

-X
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines