4 Replies Latest reply on Apr 7, 2010 12:44 PM by haggest

    Need Help in Scripting Turning Off JPEG Processing in ACR


      Back in 2005 (Win PS CS) I wrote a javascript script which allows me to batch add captions, headlines, author, etc to JPEG image files.  When CS3 came along I found I needed to turn off ACRs JPEG processing before I ran the script and on again after the script ran.  I now need to do the same thing for PS CS4 and soon CS5.  I have tried to create two (one off - another for on) actions to do that but they don't appear to work.  Can this be done by an action?  If it can done by an action can it be scripted?


      I want to thank Michael L. Hale for the great code below which worked in PS CS3:


      // Oct 3, 2007 this code from from Michael L Hale - Adobe Forums - Photoshop Scripting
      // This code allows one to determine and/or set the state of jpeg file handling in ACR
      // (i.e. get current user setting for edit->pref->file handling->file compatibility->prefer Adobe Camera Raw for JPEG files.
      // Usage: cameraRawJPEG(bool)
      //   JpegState = cameraRawJPEG();  // true if open jpegs in ACR is on, else false
      //    cameraRawJPEG(false);  // turns OFF "open jpegs in ACR"
      //    cameraRawJPEG(true);  // turns ON "open jpegs in ACR"
          var ref = new ActionReference();
          ref.putProperty( charIDToTypeID( "Prpr" ), charIDToTypeID( "FlSP" ) );
          ref.putEnumerated( charIDToTypeID( "capp" ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ) );
          if(bool != undefined && bool.constructor == Boolean){
              var desc = new ActionDescriptor();
              desc.putReference( charIDToTypeID( "null" ), ref );
              var desc1 = new ActionDescriptor();
              desc1.putBoolean( stringIDToTypeID( "cameraRawJPEG" ), bool );
              desc.putObject( charIDToTypeID( "T   " ), charIDToTypeID( "FlSv" ), desc1 );
              executeAction( charIDToTypeID( "setd" ), desc, DialogModes.NO );
          return executeActionGet(ref).getObjectValue(charIDToTypeID( "FlSP" )).getBoolean(stringIDToTypeID( "cameraRawJPEG" ));


      Using the scriptlistener I was able to get the code below, but it doesn't work. I think for the same reason that regular actions Edit --> Preferences -->Camera Raw -->Jpeg & Tiff Handling -->Disable JPEG support  doesn't work:


      // ===ACR JPEG Off ====================================================
      function ACR_JPEG_Off() {
      var idDlt = charIDToTypeID( "Dlt " );
          var desc3 = new ActionDescriptor();
          var idnull = charIDToTypeID( "null" );
              var ref2 = new ActionReference();
              var idActn = charIDToTypeID( "Actn" );
              ref2.putName( idActn, "jpeg-off" );
              var idASet = charIDToTypeID( "ASet" );
              ref2.putName( idASet, "Default Actions" );
          desc3.putReference( idnull, ref2 );
        executeAction( idDlt, desc3, DialogModes.NO );