Skip to main content
Participant
June 4, 2025
Answered

Scripting: export only user slices in Save to Web

I'm working with a script that exports slices of a PSD.

Just wondering how to program my JS script to export only user slices (see image)?

By default it exports all, including unnecessary auto slices.

Thanks

Stephen Marsh
Stephen MarshCorrect answer
Community Expert
July 11, 2025

Comparing the ScriptListener recordings for an export with All Slices vs. User Slices, the key differences appear to be:

 

File Name (ovFN) for All Slices:

desc103.putString( idovFN, """myTestSliceDoc_01.jpg""" )

 

File Name (ovFN) for User Slices:
This line apparently isn't used/required

 

_______________

 

Slice Selection (SWsl) for All Slices:

desc103.putEnumerated( idSWsl, idSTsl, idSLAl );

 

Slice Selection (SWsl) for User Slices:

desc121.putEnumerated( idSWsl, idSTsl, idSLUs );

 

Hope this helps. 

4 replies

Stephen Marsh
Community Expert
Community Expert
July 11, 2025

Presuming legacy ExtendScript, not UXP... This isn't covered by the DOM, so you would need AM code. Have you tried ScriptListener?

Translate
Stephen Marsh
Community Expert
Stephen MarshCommunity ExpertCorrect answer
Community Expert
July 11, 2025

Comparing the ScriptListener recordings for an export with All Slices vs. User Slices, the key differences appear to be:

 

File Name (ovFN) for All Slices:

desc103.putString( idovFN, """myTestSliceDoc_01.jpg""" )

 

File Name (ovFN) for User Slices:
This line apparently isn't used/required

 

_______________

 

Slice Selection (SWsl) for All Slices:

desc103.putEnumerated( idSWsl, idSTsl, idSLAl );

 

Slice Selection (SWsl) for User Slices:

desc121.putEnumerated( idSWsl, idSTsl, idSLUs );

 

Hope this helps. 

Translate
justlearnskills
Community Expert
Community Expert
June 4, 2025

@stronkium how would Photoshop know which 'unnecessary slices' are? 

Translate
m
chikwa
Participant
July 10, 2025

Because the other option in that 'slices' dropdown is 'selected slices', so presumably since Photoshop knows what the total are what's selected, it can ignore the unselected.

Translate