Copy link to clipboard
Copied
Basically, I'm trying to make an action run every time i select a layer/change from a layer to another through the Script Events Manager on PS CC 2013, but I don't see it in the "Photoshop Event:" dropdown menu. There's an option to add an event but I don't know if this is even possible or how could I look for it, so any help would be massively appreciated.
The reason I want to do this is so that every time I change a layer and undo the first brush stroke i paint, it takes me back to the previous layer which is annoying and could lead to painting on the wrong layer. My idea would be to make it so that the quick mask mode is quickly toggled on and then back off through an action, every time i change layers, to prevent this photoshop behavior. Since entering and then exiting quick mask mode is stored on the history panel, I would stay in the current selected layer regardless if I undo the first brush stroke. I know they fixed this odd behaviour in current versions but currently I can't update so I'm trying to work around it with this theorical method.
If there's a better way to do this though, I'm all ears. I want it to be as seamless as possible with a very minuscule performance impact and easy to do for someone who doesnt know how to script.
I attached an image to illustrate my point
Event Name:
Whatever you want, such as Select Layer
Descriptive Label (case sensitive, lowercase):
select
Exit Photoshop.
Find this in the Script Events Manager.xml file
....
<7>
<name>Export Document</name>
<value>Expr</value>
<valueClass></valueClass>
</7>
<8>
<name>Everything</name>
<value>All </value>
<valueClass></valueClass>
</8>
<9>
<name>Select Layer</name>
<value>select</value>
<valueClass>layer</valueClass>
</9>
</events>
....
Add what is indicated in red.
Save the file, launch Photoshop and reassign the event.
The script will only respond to the selection of a layer and not to the selection of a tool, and
...Copy link to clipboard
Copied
More on the SEM here:
https://prepression.blogspot.com/2021/10/photoshop-script-events-manager.html
You can use the ScriptingListener plugin to see if an event is triggered, not all of them are listed in Appendix A: Event ID Codes.
I'll take a look later when I have time.
Copy link to clipboard
Copied
Thank you, I'll be waiting for you asnwer. Appreciate it.
Copy link to clipboard
Copied
Event Name:
Whatever you want, such as Select Layer
Descriptive Label (case sensitive, lowercase):
select
Copy link to clipboard
Copied
Thank you so much!! I just tried it and that seems to work perfectly for what I needed.
Do you think my approach is the right one, Stephen? Should I use something else in the action, instead of the quick mask mode stuff, that will also register in the history panel and will have an even smaller performance impact?
Copy link to clipboard
Copied
.
Copy link to clipboard
Copied
In a simplified version, you can do this
And assign such a script
if (app.documents.length) app.activeDocument.suspendHistory("Select", "");
UPD. In the screenshot, the values in the lines are mixed up. But in this case it works due to a Photoshop glitch.
Copy link to clipboard
Copied
(my bad, I didn't see your comment before)
This worked, but is there a way to undo multiple steps in the same layer? I'm having the issue that when Photoshop detects i undo the second step, it basically "selects" the layer again, running the script and rendering unusable, since it doesn't let me undo any more steps other than the first one. As far as performance and everything else, this is great
Copy link to clipboard
Copied
Exit Photoshop.
Find this in the Script Events Manager.xml file
....
<7>
<name>Export Document</name>
<value>Expr</value>
<valueClass></valueClass>
</7>
<8>
<name>Everything</name>
<value>All </value>
<valueClass></valueClass>
</8>
<9>
<name>Select Layer</name>
<value>select</value>
<valueClass>layer</valueClass>
</9>
</events>
....
Add what is indicated in red.
Save the file, launch Photoshop and reassign the event.
The script will only respond to the selection of a layer and not to the selection of a tool, and so on.
Copy link to clipboard
Copied
I'm so grateful for your help, this is exactly what I was looking for, I knew it had to be possible somehow.. Thanks again guys.
Copy link to clipboard
Copied