Copy link to clipboard
Copied
Hello,
I'm looking to apply a short cut key that would toggle brush options to sample between the "Current Layer, Current & Below and All Layers" options when using clone stamp or heal stamps tools.
Is this optional?
Thanks in advance.
OK ))
try
{
var r = new ActionReference();
r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("tool"));
r.putEnumerated(stringIDToTypeID("application"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));
var ret = executeActionGet(r);
var options = ret.getObjectValue(stringIDToTypeID("currentToolOptions"));
var tool = ret.getEnumerationType(stringIDToTypeID("tool"));
var s = options.getBoolean(charIDToTypeID("StmS"));
var b =
...
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Thank you, r-bin!
How may I correctly write an "if" statement in the script to toggle between these 2 actions using the same hotkey?
// Current layer
options.putBoolean(charIDToTypeID("StmS"), false);
options.putBoolean(charIDToTypeID("StmB"), false);
// Current & below
options.putBoolean(charIDToTypeID("StmS"), true);
options.putBoolean(charIDToTypeID("StmB"), true);
Copy link to clipboard
Copied
OK ))
try
{
var r = new ActionReference();
r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("tool"));
r.putEnumerated(stringIDToTypeID("application"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));
var ret = executeActionGet(r);
var options = ret.getObjectValue(stringIDToTypeID("currentToolOptions"));
var tool = ret.getEnumerationType(stringIDToTypeID("tool"));
var s = options.getBoolean(charIDToTypeID("StmS"));
var b = options.getBoolean(charIDToTypeID("StmB"));
if (s && b)
{
options.putBoolean(charIDToTypeID("StmS"), false);
options.putBoolean(charIDToTypeID("StmB"), false);
}
else
{
options.putBoolean(charIDToTypeID("StmS"), true);
options.putBoolean(charIDToTypeID("StmB"), true);
}
var r = new ActionReference();
r.putClass(tool);
var d = new ActionDescriptor();
d.putReference(stringIDToTypeID("null"), r);
d.putObject(stringIDToTypeID("to"), stringIDToTypeID("null"), options);
executeAction(stringIDToTypeID("set"), d, DialogModes.NO);
}
catch (e) { /*alert(e)*/ }
Copy link to clipboard
Copied
Very helpful, much appreciated!
Thanks again r-bin.
Copy link to clipboard
Copied
hi all, may i know how to apply this script to get this short cut? i really need this to speed up my editing. thanks you very much for the efford!
Mango
Copy link to clipboard
Copied
After you added the script it appears in the keyboard shortcuts option under 'Scripts'. Here you can assign the shortcut