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!
Current settings of the operation
-
pfaffenbichler
Current settings of the operation
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?
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
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)!
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
Making things more complicated than necessary can be a big temptation sometimes …
Do you make an html5 or a Configurator Panel?
Do you make an html5 or a Configurator Panel?
-
tyr
Current settings of the operation
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
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?
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
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
Thanks for the link, I’ll have to peruse that more closely.