Randomizing parameter values in an action
Hi to all,
I have an action that executes a filter from the filter gallery in Photoshop with certain parameter values. What I need is to randomize those values on each execution of the action in a range between certain min and max values. Here is an example of the action in JavaScript made from xtools:
function Action1() {
// Filter Gallery
function step1(enabled, withDialog) {
if (enabled != undefined && !enabled)
return;
var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
var desc1 = new ActionDescriptor();
desc1.putEnumerated(cTID('GEfk'), cTID('GEft'), cTID('Txtz'));
desc1.putEnumerated(cTID('TxtT'), cTID('TxtT'), cTID('TxCa'));
desc1.putInteger(cTID('Scln'), 97);
desc1.putInteger(cTID('Rlf '), 17);
desc1.putEnumerated(cTID('LghD'), cTID('LghD'), cTID('LDTL'));
desc1.putBoolean(cTID('InvT'), false);
executeAction(1195730531, desc1, dialogMode);
};
step1(); // Filter Gallery
};
In
desc1.putInteger(cTID('Scln'), 97);
desc1.putInteger(cTID('Rlf '), 17);
are the parameter values I need to randomize on each execution of the script, I know there must be something with Math.random(), but please if someone could guide me or preferably provide me the exact code part that makes the randomization so I can edit it in the future. I am working on a project of my own and need fast execution of certain filters with applied ranged randomization of the values. If this is possible it would be of great value to me.
Thank you in advance for anyone's help that will come.
TB
