Copy link to clipboard
Copied
Looking for a way to possibly assign a keyboard shortcut to toggle "Aligned" on/off when I'm using my Clone Stamp. I've scoured the menus and did an exhaustive search of the shortcuts and menu options but maybe I've missed it? ...or it's not possible?
If it's not possible, no big deal. My solution to the problem was to create a series of Brush Presets with all the tool info in them and that's fine...but I use a 32-button device for hotkeys/macros/multiple actions that speeds up my workflow like mad. It'd be great to be able to hit the toggle button with my pinky while continuing to clone uninterrupted.
If anyone has any insight, I'd appreciate it!
Currently using 23.3.1 and Beta 23.4.0
Please try this one …
// thanks to Oleksii Hirlin;
// switch aligned-setting for clone stamp tool;
// 2022, use it at your own risk;
if (getCurrentTool() == "cloneStampTool") {
var ref = new ActionReference();
ref.putProperty(stringIDToTypeID('property'), stringIDToTypeID("currentToolOptions"));
ref.putEnumerated( charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var applicationDesc = executeActionGet(ref);
var currentToolS = applicationDesc.getObjectValue(stringIDToTyp
...
Copy link to clipboard
Copied
I do not know for any option to assign keyboard shortcut nor is possible using Photoshop action to record as action step as far as I know. Maybe script can do the trick. Script can be run using shortcut but... you need script in first place. @Stephen Marsh @c.pfaffenbichler @Kukurykus
Copy link to clipboard
Copied
Not that I am aware of, however, saving a tool preset would be my suggestion. One can then assign a F-key action keyboard shortcut or play the action from a script (or directly script the tool preset) with a more flexible shortcut.
Copy link to clipboard
Copied
You could try this Script.
Edit: Removed the Script because it did not work as intended
Copy link to clipboard
Copied
This is giving me hope! Right off the bat, the above script isn't working but this is probably user error...I know nothing of scripting outside of poking around in a .JSX file and getting it to the proper directory. Is the snippet you posted above missing a function or anything to run it / end it?
Decided to do a few tests and went down a rabbit hole of the author mentioned inside the script. I was able to use his Switch Sample Mode script successfully and to great effect. (and so excited I found this through you, so thank you!)
Appreciate your time and patience.
Copy link to clipboard
Copied
What error message do you get?
Works fine here for the Clone Stamp Tool.
Copy link to clipboard
Copied
Same issue for me, no error but no result either in v2021.
Copy link to clipboard
Copied
Is the Clone Stamp Tool selected?
Copy link to clipboard
Copied
Yes, that was the first thing I tried. I'll have a go in v2022 tomorrow and also try resetting prefs.
Copy link to clipboard
Copied
No idea what the problem could be.
Both on Photoshop 2021 and Photoshop 2022 the Script switches »Aligned« on/off for the Clone Stamp Tool for me.
Copy link to clipboard
Copied
The Switch Sample Mode script works great and actually does switch between Current, Current & Blow and All Layers for me. (again, I love it so thanks for the great find).
Tried the Aligned toggle script again with Beta. Clone Stamp was selected both times. Also tried starting with Aligned checked and also Aligned unchecked. Still not working.
I reset Prefs in both 23.3.1 and Beta 23.4.0 but still no change, unfortunately.
Well, thank you for your help...very much appreciate all the feedback.
Copy link to clipboard
Copied
Could you try this one?
Do you get any alerts from it?
edit: removed faulty script
Copy link to clipboard
Copied
I get "align is true" when I run it initially. And "align is false" if I run it again.
The actual Aligned state doesn't change from whatever it is currently on though.
Copy link to clipboard
Copied
If the Script alerts that »Aligned« is true/false without the Options Bar reflecting that I wonder if it might not display the change. (Which would naturally be another problem …)
Could you try the Clone Stamp Tool to make sure?
Copy link to clipboard
Copied
Regardless of what the script alert says, the Clone Stamp is only responding to whether the state is active or inactive in the Options Bar. So still seems like PS is ignoring the script's intent.
Copy link to clipboard
Copied
If you feel like trouble-shooting this further please try below Script once with »Aligned« checked and once unchecked.
Here the key in question is 32 and seems to have no name (see screenshot), maybe there is a possibility that that might be different on other installations.
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var applicationDesc = executeActionGet(ref);
var currentToolS = applicationDesc.getObjectValue(stringIDToTypeID("currentToolOptions"));
checkDesc2(currentToolS);
////////////////////////////////////
////// based on code by michael l hale //////
function checkDesc2 (theDesc) {
var c = theDesc.count;
var str = '';
for(var i=0;i<c;i++){ //enumerate descriptor's keys
str = str + 'Key '+i+' = '+typeIDToStringID(theDesc.getKey(i))+': '+theDesc.getType(theDesc.getKey(i))+'\n'+getValues (theDesc, i)+'\n';
};
alert("desc\n\n"+str);
};
////// check //////
function getValues (theDesc, theNumber) {
switch (theDesc.getType(theDesc.getKey(theNumber))) {
case DescValueType.ALIASTYPE:
return theDesc.getPath(theDesc.getKey(theNumber));
break;
case DescValueType.BOOLEANTYPE:
return theDesc.getBoolean(theDesc.getKey(theNumber));
break;
case DescValueType.CLASSTYPE:
return theDesc.getClass(theDesc.getKey(theNumber));
break;
case DescValueType.DOUBLETYPE:
return theDesc.getDouble(theDesc.getKey(theNumber));
break;
case DescValueType.ENUMERATEDTYPE:
return (typeIDToStringID(theDesc.getEnumerationValue(theDesc.getKey(theNumber)))+"_"+typeIDToStringID(theDesc.getEnumerationType(theDesc.getKey(theNumber))));
break;
case DescValueType.INTEGERTYPE:
return theDesc.getInteger(theDesc.getKey(theNumber));
break;
case DescValueType.LISTTYPE:
return theDesc.getList(theDesc.getKey(theNumber));
break;
case DescValueType.OBJECTTYPE:
return (theDesc.getObjectValue(theDesc.getKey(theNumber))+"_"+typeIDToStringID(theDesc.getObjectType(theDesc.getKey(theNumber))));
break;
case DescValueType.RAWTYPE:
return theDesc.getReference(theDesc.getData(theNumber));
break;
case DescValueType.REFERENCETYPE:
return theDesc.getReference(theDesc.getKey(theNumber));
break;
case DescValueType.STRINGTYPE:
return theDesc.getString(theDesc.getKey(theNumber));
break;
case DescValueType.UNITDOUBLE:
return (theDesc.getUnitDoubleValue(theDesc.getKey(theNumber))+"_"+typeIDToStringID(theDesc.getUnitDoubleType(theDesc.getKey(theNumber))));
break;
default:
break;
};
};
Copy link to clipboard
Copied
Gave it a try in the Aligned True State:
And then tried again in the Aligned False State:
Copy link to clipboard
Copied
In 23.3.2 you need to change 32 to 36 in all 3 spots.
Copy link to clipboard
Copied
Decided to do a few tests and went down a rabbit hole of the author mentioned inside the script. I was able to use his Switch Sample Mode script successfully and to great effect. (and so excited I found this through you, so thank you!)
No personal acquaintance but I adapted a part of that code so it seemed proper to mention them.
If I remember correctly that Script switches between »Current Layer« and »Current and Below«, so if you should want to incorporate the other options, too, you would need to adapt it further.
Copy link to clipboard
Copied
Hmm...no error message. I've run it via File > Scripts inside of Photoshop and I ran it straight from the desktop...both ways, nothing changes at all. The save state of the document changes (I can see the * appear in the Document tab) but that's about it. Thoughts?
Copy link to clipboard
Copied
Please try this one …
// thanks to Oleksii Hirlin;
// switch aligned-setting for clone stamp tool;
// 2022, use it at your own risk;
if (getCurrentTool() == "cloneStampTool") {
var ref = new ActionReference();
ref.putProperty(stringIDToTypeID('property'), stringIDToTypeID("currentToolOptions"));
ref.putEnumerated( charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var applicationDesc = executeActionGet(ref);
var currentToolS = applicationDesc.getObjectValue(stringIDToTypeID("currentToolOptions"));
var theAlign = currentToolS.getBoolean(1400139073);
var desc = new ActionDescriptor();
var ref = new ActionReference();
ref.putClass( stringIDToTypeID( app.currentTool ) );
desc.putReference( stringIDToTypeID( "target" ), ref );
//////
if (theAlign == true) {
currentToolS.putBoolean(1400139073, false)
} else {
currentToolS.putBoolean(1400139073, true)
};
//////
desc.putObject( stringIDToTypeID( "to" ), stringIDToTypeID( "currentToolOptions" ), currentToolS );
executeAction( stringIDToTypeID( "set" ), desc, DialogModes.NO );
};
////////////////////////////////////
function getCurrentTool() {
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
return typeIDToStringID(executeActionGet(ref).getEnumerationType(stringIDToTypeID('tool')));
};
Copy link to clipboard
Copied
Winner winner chicken dinner!
This did it. I'm not sure what differed from the original (went back and tried and it still doesn't work). But the above version instantly worked...was able to record it into an Action and then turn it into a one-button press on my Stream Deck.
Thank you so much for your work and all your help. Beyond appreciated. 🙂
Copy link to clipboard
Copied
@Peter James Zielinski – is there a specific reason to record the script into an Action? I haven't used a Stream Deck. Keyboard shortcuts can be applied directly to installed scripts without having to put them into an action for use with an F-Key.
Copy link to clipboard
Copied
To be completely honest, I hadn't even realized you could assign keyboard shortcuts to scripts since I've used them so little. Good to know, just got rid of the action and directly used the shortcut instead.
The Stream Deck was a game changer for me. 32 LCD button macro device. You can fill each button with text, pre-made graphics, or graphics you make yourself. You can also nest folders so there's an infinite amount of 32 button pages you can make. It'll also let you access F13-F24 so you can expand on PS's number of shortcuts possible. Here's my main photoshop page (you can see I just added Toggle Align and Switch Sample Mode bottom right.):
You can integrate it with the Deck's multi-actions and come up with some tricky things. For example, when I want to send a client a first pass I'll:
Save my current document, duplicate the doc so there's no chance of me saving over it, while in that duplicate dialogue, append "_PJZEDIT_v001" to the end, change the colorspace to sRGB, flatten again just to be sure, Save As, navigate to the Desktop, create a folder called v001, and then save it there as a JPG at 12 max quality.
For that, I have the Deck pull up a modified version of Russell Brown's Image Processor Pro script, put in a few 1000ms delays so PS doesn't trip over its own feet and does all the steps in order, have it manually type out the name of a saved .XML file (which has the name change, the file type, and place I want it saved to in it), and then hit Return twice. So, all of 9 or 10 steps above become a one-button press.
Might be overkill but I enjoy finding ways to make 3 to 25-step processes into a one-button press. Nerd stuff. 🙂
Now that you and @c.pfaffenbichler have shown me how useful scripts are...I"m going to have to pick up Javascript and start digging deeper.
Thanks again for your help today!
Copy link to clipboard
Copied
Try XMouse Button Control if you seriously thinking of speeding up your workflow.