PHOTOSHOP - Enter command in a java script to skip dialog box

  • 1
  • Question
  • Updated 3 years ago
  • (Edited)
How can I add an 'Enter' - command in a java script?
I want to create an adjustment layer via an extension panel, without always having to confirm the dialog box.

Photoshop CS6 Extended, 64bit

This is the script code for one adjustment for example (Brightness / Contrast):

ErrStrs = {}; ErrStrs.USER_CANCELLED=localize("$$$/ScriptingSupport/Error/UserCancelled=User cancelled the operation"); try {var idMk = charIDToTypeID( 'Mk ' ); var desc173 = new ActionDescriptor(); var idnull = charIDToTypeID( 'null' ); var ref158 = new ActionReference(); var idcontentLayer = stringIDToTypeID( 'contentLayer' ); ref158.putClass( idcontentLayer ); desc173.putReference( idnull, ref158 ); var idUsng = charIDToTypeID( 'Usng' ); var desc174 = new ActionDescriptor(); var idType = charIDToTypeID( 'Type' ); var idBrgC = charIDToTypeID( 'BrgC' ); desc174.putClass( idType, idBrgC ); var idcontentLayer = stringIDToTypeID( 'contentLayer' ); desc173.putObject( idUsng, idcontentLayer, desc174 ); executeAction( idMk, desc173, DialogModes.ALL ); } catch(e){if (e.toString().indexOf(ErrStrs.USER_CANCELLED)!=-1) {;} else{alert(localize("$$$/ScriptingSupport/Error/CommandNotAvailable=The command is currently not available"));}}
Photo of fai

fai

  • 6 Posts
  • 0 Reply Likes

Posted 3 years ago

  • 1
Photo of Chris Cox

Chris Cox

  • 20280 Posts
  • 813 Reply Likes
Just set the playback option on that command to not show dialogs.
Photo of fai

fai

  • 6 Posts
  • 0 Reply Likes
It ́s no usual action. It ́s a button delievered within Adobe Configurator 4. If there is that option, I don ́t know where it is. Do you know?
Photo of Chris Cox

Chris Cox

  • 20280 Posts
  • 813 Reply Likes
In your JavaScript, you told it to display all dialogs (DIalogModes.ALL). Just tell it not to not display dialogs instead (DialogModes.NO).
Photo of fai

fai

  • 6 Posts
  • 0 Reply Likes
Yep, I found that out just before you posted :) Thanks anyways!
But one more thing: Is there a way with a javascript to let the properties panel automatically open up when I press the adjustment? I make a reply to demonstrate you what I mean.
Photo of Chris Cox

Chris Cox

  • 20280 Posts
  • 813 Reply Likes
You would have to add code to show the properties panel.
Photo of fai

fai

  • 6 Posts
  • 0 Reply Likes
I need this window still to be popped up when selecting the adjustment.
Photo of Chris Cox

Chris Cox

  • 20280 Posts
  • 813 Reply Likes
Then the user will have to press Enter to commit the settings - there is no way to show the dialog and not have the user commit the entry once they're done entering values.
Photo of fai

fai

  • 6 Posts
  • 0 Reply Likes
I think you misunderstood (or maybe I, not sure). I want that dialog to pop up (the one in the picutre), but only the 'layer name' dialog box NOT to pop up. Is there a way to access that dialog box shown in the picture above with java script?
I just want to skip the layer naming part, which comes one step before.
Photo of Chris Cox

Chris Cox

  • 20280 Posts
  • 813 Reply Likes
Yes, you can access the Brightness/Contrast adjustment and either show or not show the dialog.

The Layer name dialog is something separate, which you can choose to show, or not show when you set the layer name.
Photo of fai

fai

  • 6 Posts
  • 0 Reply Likes
And how do I do that?
Photo of Chris Cox

Chris Cox

  • 20280 Posts
  • 813 Reply Likes
You might try posting in the Photoshop Scripting forum: https://forums.adobe.com/community/ph...