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: 2
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!

Professional AI Audio Generation within Adobe Premiere Pro - Download Free Plugin here

Sophiasm
Posts: 1
Joined: Fri May 23, 2025 7:19 am
Location: https://monkeymartgame.org

Re: Script to delete unselected layers with toggle if possible

Post by Sophiasm »

You could try creating a script that first duplicates your composition, then, in the duplicate, deletes all layers except the selected one to flip horizontally. After you finish, you return to the original with all layers intact. This way, you avoid deleting and restoring layers repeatedly, making your workflow safer and faster. Also, consider using layer solo/mute toggles instead of deleting layers—that might achieve the same effect without losing anything.
jenniekimberly
Posts: 1
Joined: Tue May 27, 2025 2:21 am
Location: https://crazy-cattle3d.io

Re: Script to delete unselected layers with toggle if possible

Post by jenniekimberly »

This would be super useful for cleaning up the comp temporarily! A toggle like this would save so much time when flipping the canvas. Hope someone shares a solid script!