Is there a way to assign a keyboard shortcut to the "Aligned" checkbox toggle for the Clone Stamp?

Explorer ,
May 09, 2022 May 09, 2022

Copy link to clipboard

Copied

Screenshot-2022-05-09-190337.jpg

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

TOPICS
Actions and scripting , Cross-app workflows , SDK

Views

316

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Community Professional , May 10, 2022 May 10, 2022
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...

Likes

Translate

Translate
Adobe Community Professional ,
May 09, 2022 May 09, 2022

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_A_Marsh @c.pfaffenbichler @Kukurykus 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 09, 2022 May 09, 2022

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.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 10, 2022 May 10, 2022

Copy link to clipboard

Copied

You could try this Script. 

Edit: Removed the Script because it did not work as intended

 

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 10, 2022 May 10, 2022

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. 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 10, 2022 May 10, 2022

Copy link to clipboard

Copied

What error message do you get? 

Works fine here for the Clone Stamp Tool. 

cloneStampToolAlignSettingsScript.gif

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 10, 2022 May 10, 2022

Copy link to clipboard

Copied

Same issue for me, no error but no result either in v2021.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 10, 2022 May 10, 2022

Copy link to clipboard

Copied

Is the Clone Stamp Tool selected? 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 10, 2022 May 10, 2022

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.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 10, 2022 May 10, 2022

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. 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 10, 2022 May 10, 2022

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. 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 10, 2022 May 10, 2022

Copy link to clipboard

Copied

Could you try this one? 

Do you get any alerts from it? 

 

 

edit: removed faulty script

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 10, 2022 May 10, 2022

Copy link to clipboard

Copied

 Screenshot 2022-05-10 103756.jpg

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. 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 10, 2022 May 10, 2022

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? 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 10, 2022 May 10, 2022

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. 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 10, 2022 May 10, 2022

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. 

Screenshot 2022-05-10 at 17.14.23.png

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;
};
};

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 10, 2022 May 10, 2022

Copy link to clipboard

Copied

Gave it a try in the Aligned True State:
aligned_true.jpg

 

And then tried again in the Aligned False State:

aligned_false.jpg


Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 11, 2022 May 11, 2022

Copy link to clipboard

Copied

In 23.3.2 you need to change 32 to 36 in all 3 spots.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 10, 2022 May 10, 2022

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. 

 

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 10, 2022 May 10, 2022

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?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 10, 2022 May 10, 2022

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')));
	};

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 10, 2022 May 10, 2022

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. 🙂 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 10, 2022 May 10, 2022

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.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 10, 2022 May 10, 2022

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.):

 

Screenshot 2022-05-10 180641.jpg

 

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. 

 

Screenshot 2022-05-10 180719.jpg

 

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!

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 11, 2022 May 11, 2022

Copy link to clipboard

Copied

Try XMouse Button Control if you seriously thinking of speeding up your workflow.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines