Skip to main content
Inspiring
September 15, 2021
Answered

How to open trap dialog box

  • September 15, 2021
  • 1 reply
  • 441 views

How to open Image/Trap dialog box with javascript?

I know that i can complete trap with app.activeDocument.trap(), but is it possible just to open this dialog with a script?

Thanks

This topic has been closed for replies.
Correct answer Stephen Marsh
quote

Did you record the code with ScriptingListener.plugin yet? 

If so changing »DialogModes.NO« to »DialogModes.ALL« usually works to raise the corresponding dialog. 


By @c.pfaffenbichler

 

 

Yes it does work, you beat me to the post! :]

 

var idtrap = stringIDToTypeID( "trap" );
    var desc179 = new ActionDescriptor();
    var idwidth = stringIDToTypeID( "width" );
    var idpixelsUnit = stringIDToTypeID( "pixelsUnit" );
    desc179.putUnitDouble( idwidth, idpixelsUnit, 1.000000 );
executeAction( idtrap, desc179, DialogModes.ALL );

1 reply

c.pfaffenbichler
Community Expert
Community Expert
September 15, 2021

Did you record the code with ScriptingListener.plugin yet? 

If so changing »DialogModes.NO« to »DialogModes.ALL« usually works to raise the corresponding dialog. 

Stephen Marsh
Community Expert
Stephen MarshCommunity ExpertCorrect answer
Community Expert
September 15, 2021
quote

Did you record the code with ScriptingListener.plugin yet? 

If so changing »DialogModes.NO« to »DialogModes.ALL« usually works to raise the corresponding dialog. 


By @c.pfaffenbichler

 

 

Yes it does work, you beat me to the post! :]

 

var idtrap = stringIDToTypeID( "trap" );
    var desc179 = new ActionDescriptor();
    var idwidth = stringIDToTypeID( "width" );
    var idpixelsUnit = stringIDToTypeID( "pixelsUnit" );
    desc179.putUnitDouble( idwidth, idpixelsUnit, 1.000000 );
executeAction( idtrap, desc179, DialogModes.ALL );