Any way to minimize the document that the scripts is working

Discussion of Photoshop Scripting, Photoshop Actions and Photoshop Automation in General

Moderators: Tom, Kukurykus

ddbell

Any way to minimize the document that the scripts is working

Post by ddbell »

Is there any way to minimize the document that the script is working on?

I created a progress bar window which is all I want the user to see. Most of the time, nothing except the transparency grid is displayed anyway. The window resizes a few time and every now and then there is a hint of something happening in the image. I think it would look more professional to just see the progress bar and not all of the other stuff.

Professional AI Audio Generation within Adobe Premiere Pro - Download Free Plugin here

Mike Hale

Any way to minimize the document that the scripts is working

Post by Mike Hale »

I don't think there is a way to minimize the document. And I believe that, even if the document starts out minimized, the first time the script does anything to the document Photoshop restores the window.

But you can use the function below to set the zoom of the document to something really same so the changes are not visible. You could then use the same function to set the zoom to something higher after the script is done working on the doc.

Code: Select allfunction setZoom( zoom ) {// as percent
   cTID = function(s) { return app.charIDToTypeID(s); }; // from xbytor
   var docRes = activeDocument.resolution;
   activeDocument.resizeImage( undefined, undefined, 72/(zoom/100), ResampleMethod.NONE );
   var desc = new ActionDescriptor();
   var ref = new ActionReference();
   ref.putEnumerated( cTID( "Mn  " ), cTID( "MnIt" ), cTID( 'PrnS' ) );
   desc.putReference( cTID( "null" ), ref );
   executeAction( cTID( "slct" ), desc, DialogModes.NO );
   activeDocument.resizeImage( undefined, undefined, docRes, ResampleMethod.NONE );
}
setZoom( .85 );
ddbell

Any way to minimize the document that the scripts is working

Post by ddbell »

Adjusting the zoom is good enough for what I need. The progress bar window covers it up so it works out.

Also, at least on my computer, the script was setting the zoom to about 4X of the value of which its assigned. For some reason it needed to be 300 /(zoom/100) instead of 72/(zoom/100) to make it zoom to the correct value. I wonder if its the same for all Photoshop versions or if some need to be 72 and others 300. I only tested it in CS3.

I transposed the formula to 30000/zoom for my script and its working perfectly.

Thanks

activeDocument.resizeImage( undefined, undefined, 30000/zoom, ResampleMethod.NONE );