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

Script problems since Photoshop 24.3

Contributor ,
Mar 23, 2023 Mar 23, 2023

Hello,

Unfortunately some scripts don't work anymore or work differently since the update.

Example is my Zoom to Printsize Script... Suddenly there is always a query about the image size in each step.

Before everything just ran through.

//Get Zoom Level new Size 

function zoomLevel(){
if(!documents.length) return;
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") ); 
var desc = executeActionGet(ref);
return desc.getDouble(stringIDToTypeID('zoom'))*100;
}
var zoom1 = zoomLevel()



//Go to Print Size

if(documents.length ) zoomToPrint();
function zoomToPrint() { 
   var ref3 = new ActionReference(); 
   ref3.putEnumerated( charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") ); 
   var screenRes = executeActionGet(ref3).getObjectValue(stringIDToTypeID('unitsPrefs')).getUnitDoubleValue(stringIDToTypeID('newDocPresetScreenResolution'))/72;    
   var docRes = activeDocument.resolution; 
   var docInchs = activeDocument.width.as('px')/docRes;
   var screenInchs = docInchs * screenRes;
   var pix = activeDocument.width.as('px')/screenInchs;
   var zoom = 100/pix;
   activeDocument.resizeImage( undefined, undefined, screenRes/(zoom/100), ResampleMethod.NONE ); 
   var desc3 = new ActionDescriptor(); 
   ref3 = null;
   ref3 = new ActionReference(); 
   ref3.putEnumerated( charIDToTypeID( "Mn  " ), charIDToTypeID( "MnIt" ), charIDToTypeID( 'PrnS' ) ); 
   desc3.putReference( charIDToTypeID( "null" ), ref3 ); 
   executeAction( charIDToTypeID( "slct" ), desc3, DialogModes.NO ); 
   activeDocument.resizeImage( undefined, undefined, docRes, ResampleMethod.NONE ); 
};

//Get Zoom Level Print Size 

function zoomLevel2(){
if(!documents.length) return;
var ref2 = new ActionReference();
ref2.putEnumerated( charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") ); 
var desc2 = executeActionGet(ref2);
return desc2.getDouble(stringIDToTypeID('zoom'))*100;
}
var zoom2 = zoomLevel2()

//Back to view

  function getScreenRes(){
     var refi = new ActionReference();
     refi.putEnumerated( charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
     return executeActionGet(refi).getObjectValue(stringIDToTypeID('unitsPrefs')).getUnitDoubleValue(stringIDToTypeID('newDocPresetScreenResolution'))/72;
  }
  function setZoom( zoom ) {
     cTID = function(s) { return app.charIDToTypeID(s); };
     var docResi = activeDocument.resolution;
     activeDocument.resizeImage( undefined, undefined, getScreenRes()/(zoom/100), ResampleMethod.NONE );
     var desci = new ActionDescriptor();
     var refi = new ActionReference();
     refi.putEnumerated( cTID( "Mn  " ), cTID( "MnIt" ), cTID( 'PrnS' ) );
     desci.putReference( cTID( "null" ), refi );
     executeAction( cTID( "slct" ), desci, DialogModes.NO );
     activeDocument.resizeImage( undefined, undefined, docResi, ResampleMethod.NONE );
  }
  setZoom (zoom1);





//Calculate

var doc = app.activeDocument;

var Osize = zoom2
var Zsize = zoom1

var Zoomval= Math.round(Zsize/Osize*100*100)/100;


alert(Zoomval+" % copy to clipboard ")
  
    var d9 = new ActionDescriptor();  
d9.putString(stringIDToTypeID("textData"), Zoomval);  
executeAction(stringIDToTypeID("textToClipboard"), d9, DialogModes.NO); 

 

TOPICS
Actions and scripting , Windows
333
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
Mentor ,
Mar 25, 2023 Mar 25, 2023

I cannot reproduce your issue.

Tried including app.preferences.displayDialogs = DialogModes.ALL, tried different units (by the way, activeDocument.width.as('px') doesn't work if percentages are used as rulerUnits), never saw any dialog other than scale alert.

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
Contributor ,
Mar 27, 2023 Mar 27, 2023
LATEST

Hello and thanks for the quick help!

It seems that Photoshop had a malfunction.

Today everything works again as it should 🙂

 

still many thanks for the help !!!

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