Script to delete unselected layers with toggle if possible

Discussion of Photoshop Scripting, Photoshop Actions and Photoshop Automation in General

Moderators: Tom, Kukurykus

byxa
Posts: 1
Joined: Fri May 09, 2025 8:50 am

Script to delete unselected layers with toggle if possible

Post by byxa »

hi guys,
im looking for a script that delete all the layers arent selected.
does anyone has an idea how to delete all the other layers and then toggle the action - mining:

1st delete all the NOT selected layers
2nd bring back the deleted layers.


the reason for this, is because i have a larger composition and i need to flip horizontally the canvas to check errors and to make the file smaller so i can flip horizontally the canvas. i need only 1 layer to do so.
then after i will continue to work and i will need all the deleted layers back. that is the reason for the toggle function.

i will appreciate you help.

thanks in advance!