Skip to main content
Participant
May 23, 2025
Question

[Photoshop JSX] Persistent Issue: Unable to Delete Action Sets from Script (Duplicates)

  • May 23, 2025
  • 1 reply
  • 228 views

Hello everyone,

I'm seeking help with a persistent issue regarding Photoshop automation via JSX scripting.

My goal: To load an .atn file (action set) into the Actions panel, run an action, and then save a PSD file. To avoid duplicates in the Actions panel, I need to delete the pre-existing action set (specifically action_set_atn) before reloading it.

The problem: Despite numerous attempts, I'm unable to reliably delete the action set action_set_atn using a JSX script. Every time the script runs, a new duplicate of the action set is created in Photoshop's Actions panel.

Photoshop Version: Adobe Photoshop 26.7.0

What I've tried (and failed):

  • app.unload("action_set_atn"): The standard high-level command. It doesn't remove duplicates.
  • executeAction commands for deletion (ID: "Dlt "): I've tried various configurations of this low-level command, attempting to target the set by name and by index.
  • executeAction command to reset all action sets (ID: "Rset"): Even this drastic operation, which should theoretically clear all sets, didn't prevent duplicate creation upon subsequent loading.
  • Adding delays ($.sleep()) and history management: I've tried introducing pauses for synchronization and suspending/resuming history to avoid conflicts.
  • Log analysis: Debugging logs showed that executeAction commands for "Make" (creating) an action set fail with the error "The command 'Make' is not currently available." This suggests a fundamental limitation in the script's execution context.

Context:

My script runs Photoshop in an automated environment (launched via command line).

The question:

Is there a 100% reliable way to delete a specific action set (action_set_atn) from a JSX script in this automation context? Or is the limitation on action set manipulation (creation/deletion) via scripting in headless environments an expected behavior?

Any insights or workarounds would be greatly appreciated.

Thanks!

1 reply

c.pfaffenbichler
Community Expert
Community Expert
May 23, 2025
var desc4 = new ActionDescriptor();
var ref1 = new ActionReference();
ref1.putName( stringIDToTypeID( "actionSet" ), "action_set_atn" );
desc4.putReference( stringIDToTypeID( "null" ), ref1 );
executeAction( stringIDToTypeID( "delete" ), desc4, DialogModes.NO );

seems to work fine here. 

 

If there are already multiples it should be able to just use a while and a try-clause. 

Participant
May 23, 2025

Hello c.pfaffenbichler,

Thank you so much for your reply and for the suggestion! I really appreciate your help and the time you took to test the solution.

I tried implementing your code for deletion (var desc4 = new ActionDescriptor(); ... executeAction( stringIDToTypeID( "delete" ), desc4, DialogModes.NO );) in my JSX script, integrating it with while loops and try-catch blocks as you suggested to handle potential multiples.

Unfortunately, even with this solution, the problem of duplicates persists, and the action set is not reliably deleted.

After further testing and in-depth log analysis, we've encountered some limitations that appear to be specific to my environment:

  • app.actionSets is unreliable: The app.actionSets method (used to read loaded action sets) consistently reports that no action sets are loaded, even when Photoshop visually displays them in the Actions panel. This makes it impossible for the script to "see" or verify the existence of pre-existing sets.
  • Action manipulation commands are blocked: Low-level commands like executeAction for "Make" (creating) an action set, or for "Delete" (deleting) a set, seem to be blocked in my version of Photoshop (26.7.0) when the application is launched from the command line. I receive errors like "The command 'Make' is not currently available." This suggests a fundamental limitation of the script's execution context.

In my specific environment, It seems that managing action set operations (creation, deletion, and even reliable status reading) isn't fully exposed or supported via the JSX scripting API in this automated context.

Thank you again for your valuable contribution! It was still very helpful for the diagnostic process.

Do you happen to have any other suggestions, perhaps related to external workarounds, given these specific environment limitations?

c.pfaffenbichler
Community Expert
Community Expert
May 23, 2025

I am less than optimistic but could you post screenshots or a screen recording that includes the Actions Panel to illustrate the process and how it fails?