Current settings of the operation

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

tyr

Current settings of the operation

Post by tyr »

Hi everyone,

I was wondering if there's a way to know what are the current settings stored in the operation I'm going to fire.

For example: if I chose Contract Selection from the menu, it's set to the last value I used. Is there a way to get this value with JS?

Thanks!

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

pfaffenbichler

Current settings of the operation

Post by pfaffenbichler »

I hope I did not muddy the water and Mike Hale or someone else with more insight will drop by.

I am not able to locate that information in the Preferences file (and anyway it would get written there only on quitting).
And I don’t know where to get the information directly.
But a work-round is possible by invoking the operation with an undefined value and thus getting the current one, then undoing the operation:
Code: Select all// 2014, use it at your own risk;
#target photoshop
if (app.documents.length > 0 && app.activeDocument.mode = DocumentMode.RGB) {
var myDocument = app.activeDocument;
var theState = myDocument.activeHistoryState;
try {
// expand;
//////
var idExpn = charIDToTypeID( "Expn" );
/*    var desc5 = new ActionDescriptor();
    var idBy = charIDToTypeID( "By  " );
    var idPxl = charIDToTypeID( "#Pxl" );
    desc5.putUnitDouble( idBy, idPxl, 127.000000 );*/
var theEntry = executeAction( idExpn, undefined, DialogModes.NO );
//////
// get value;
var theValue = theEntry.getUnitDoubleValue(theEntry.getKey(0));
// reset;
myDocument.activeHistoryState = theState;
// alert;
alert (theValue)
} catch (e) {}
};
A more direct solution would seem desirable as it would basically have to be faster and safer, but that’s the best I could come up with so far.

May I ask what the ultimate goal is here?
tyr

Current settings of the operation

Post by tyr »

Thanks for the answer, pfaffenbichler!

May I ask what the ultimate goal is here?
I'm making a panel for myself with several functions like selection modifiers, unsharp mask and so on and I hate that they always have the value from the script. Thanks for your question actually, I started to think over and realised that I'm overcomplicating things, it's easier simply run an executeAction(cTID('Expn'), undefined, DialogModes.ALL)!
pfaffenbichler

Current settings of the operation

Post by pfaffenbichler »

Making things more complicated than necessary can be a big temptation sometimes … 

Do you make an html5 or a Configurator Panel?
tyr

Current settings of the operation

Post by tyr »

html5: I've read recently that 14.3 would not support swf panels so I'm moving slowly and painfully from Configurator to html (I'm not a coder by all means).
pfaffenbichler

Current settings of the operation

Post by pfaffenbichler »

I work for print mainly so I’m a html ignoramus myself and face the same problem with the Configurator Panels I’ve been using and updating for quite a while now.
Have you been able to use multiple jsx-files in a html5 Panel or do you pack all the functions in one?
tyr

Current settings of the operation

Post by tyr »

Have you seen Davide Barranca's 'Tips on HTML Panels'? Among the other great tips he has a Including multiple JSX, works like a charm!
pfaffenbichler

Current settings of the operation

Post by pfaffenbichler »

Thanks for the link, I’ll have to peruse that more closely.