Skip to main content
LaRita
Participant
February 5, 2026
Question

JSX Script Hangs on executeAction for "Define Pattern" with 300DPI JPEGs

  • February 5, 2026
  • 0 replies
  • 1 view

!--startfragment>

I am developing a batch processing script for Photoshop (v25.x). The goal is to take 100 JPEGs (6x6 inches, 300 DPI) and apply them as a Pattern Fill Adjustment Layer inside a nested Smart Object structure (Main PSD > Level 1 SO > Level 2 SO > Pattern Fill Layer).

The Issue:

The script successfully opens the JPEG, flattens it, and performs selection.selectAll(). However, it consistently hangs (Photoshop becomes unresponsive with 'marching ants' visible) when executing the ActionDescriptor for 'setd' (Define Pattern).

What I've Tried:

  • ​Setting app.displayDialogs = DialogModes.NO
  • ​Using app.purge(PurgeTarget.ALLCACHES) between iterations.
  • ​Flattening the source document before defining the pattern.
  • ​Hardcoding the pattern name to avoid naming conflicts.
  • ​Running with GPU Acceleration disabled.

The Question:

Is there a more robust way to define a pattern from an open document that avoids the UI-thread hang, or is there a way to implement a 'Wait/Sleep' state in JSX to allow Photoshop to finish the pattern registration before the script moves to the next executeAction?

Environment: Windows!--endfragment>