• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
6

Photoshop Layer change Event ?

Explorer ,
Dec 23, 2023 Dec 23, 2023

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

TOPICS
Actions and scripting , Windows

Views

381

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 2 Correct answers

Community Expert , Dec 24, 2023 Dec 24, 2023

@GrungeVoid 

 

Event Name:

Whatever you want, such as Select Layer

 

Descriptive Label (case sensitive, lowercase):

select

Votes

Translate

Translate
People's Champ , Dec 24, 2023 Dec 24, 2023

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

...

Votes

Translate

Translate
Adobe
Community Expert ,
Dec 23, 2023 Dec 23, 2023

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.

Votes

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 ,
Dec 23, 2023 Dec 23, 2023

Copy link to clipboard

Copied

Thank you, I'll be waiting for you asnwer. Appreciate it.

Votes

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
Community Expert ,
Dec 24, 2023 Dec 24, 2023

Copy link to clipboard

Copied

@GrungeVoid 

 

Event Name:

Whatever you want, such as Select Layer

 

Descriptive Label (case sensitive, lowercase):

select

Votes

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 ,
Dec 24, 2023 Dec 24, 2023

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?

Votes

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
People's Champ ,
Dec 24, 2023 Dec 24, 2023

Copy link to clipboard

Copied

.

Votes

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
People's Champ ,
Dec 23, 2023 Dec 23, 2023

Copy link to clipboard

Copied

In a simplified version, you can do this

rbin_0-1703382115152.png

 

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.

Votes

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 ,
Dec 24, 2023 Dec 24, 2023

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

Votes

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
People's Champ ,
Dec 24, 2023 Dec 24, 2023

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.

 

Votes

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 ,
Dec 24, 2023 Dec 24, 2023

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.

Votes

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
Community Expert ,
Dec 30, 2023 Dec 30, 2023

Copy link to clipboard

Copied

LATEST

@r-bin 

 

That little bit about using the <valueClass>layer</valueClass> is gold!

Votes

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