• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
1

How do I skip a dialog box (of an adjustment), by implementing the 'enter' function within a JavaScript (in Adobe Configurator 4)?

Community Beginner ,
Jun 12, 2015 Jun 12, 2015

Copy link to clipboard

Copied

I made a custom panel with Adobe Configurator 4 with several adjustments buttons.

However, if I press for example 'Brightness/Contrast', I don´t always want to confirm the dialog box (naming the layer).

How do I skip this step? I thought about somehow implement the Enter Command in the Script, but how is that possible?

Here are several pictures to visualize what I mean:

1) nwRpQik

2) G5ORBVn

TOPICS
Actions and scripting

Views

1.5K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Enthusiast , Jun 14, 2015 Jun 14, 2015

Try this..

newBCLayer();

selLayerRGB();

setBC();

function newBCLayer() {

var desc2 = new ActionDescriptor();

var ref1 = new ActionReference();

ref1.putClass( charIDToTypeID('AdjL') );

desc2.putReference( charIDToTypeID('null'), ref1 );

var desc3 = new ActionDescriptor();

var desc4 = new ActionDescriptor();

desc4.putBoolean( stringIDToTypeID('useLegacy'), false );

desc3.putObject( charIDToTypeID('Type'), charIDToTypeID('BrgC'), desc4 );

desc2.putObject( charIDToTypeID('Usng'), charIDToTypeID('Ad

...

Votes

Translate

Translate
Adobe
Community Expert ,
Jun 12, 2015 Jun 12, 2015

Copy link to clipboard

Copied

What does your script code look like? I do not use the configurators. Each version of Photoshop need a different version. CC 2014 foes not support Flash panels so panels not must be html 5 panels. I do not know how the API work between the HTML panels and Photoshop Scripts.  IMO Photoshop has more panels then it need to have why add more.

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 12, 2015 Jun 12, 2015

Copy link to clipboard

Copied

A code example for one adjustment (in this case brightness / contrast) looks like this:

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"));}}

I already fount out that I´m able to deactivate the DialogBoxes by setting     executeAction( idMk, desc173, DialogModes.ALL )

                                        to                                                                   executeAction( idMk, desc173, DialogModes.NO )

The problem with this solution is that this also bypasses the actual panel with the adjustment sliders, which I need to be displayed after the button being pressed. It basically just creates the adjustment layer, skipping all dialogboxes. But I only

want to skip the dialog where I have to name the layer, NOT the dialog with the adjustments themselves. See picture below (this is what is ALSO skipped).

properties.jpg

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 12, 2015 Jun 12, 2015

Copy link to clipboard

Copied

Capture.jpg

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 13, 2015 Jun 13, 2015

Copy link to clipboard

Copied

Hey JJM, thanks for the answer.

The script doesn´t work for me unfortunately. Maybe I´m doing something completely wrong, not sure. How do I have to apply this piece of code?

Weird thing is, when I have the ScriptListener turned on, it doesn´t record anything in the logfile when I press the Brightness / Contrast adjustment in my panel.

Any help?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 13, 2015 Jun 13, 2015

Copy link to clipboard

Copied

But that dialog has that OK commit button you do not want. like Enter when you have to commit a name or some other values you enter in a dialog.  If you was to set the values and see the Dialog and want the user see a preview and be  able to change the values you can have the functions display the dialog with the OK commit button change .NO to .ALL.  You need to create your panel so the way you use the Brightness and Contrast Photoshop Adjustment to work without that dialog pass the brightness and contrast values you want used and bypass the dialog. Make a function and use that function.

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 13, 2015 Jun 13, 2015

Copy link to clipboard

Copied

I´m really trying to understand what you mean, but don´t quite get it.

Just to clarify again: The adjustment button in my panel first makes the layer name dialog box pop up (this is the only thing I want to skip). After that, the actual brightness / contrast values dialog box, shown in the above picture, pops up (this is ofcourse what I need).

So to speak, one OK commit button shall be skipped, and the other not. Overall, the adjustment still shall be on a seperate layer, so that it is editable later.

What´s even more weird is that I can´t record an action of that panel adjustment layer. It simply doesn´t record it, even though something happens in the programm (-> a new adjustment layer).

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 13, 2015 Jun 13, 2015

Copy link to clipboard

Copied

If you look at the way Actions record adding adjustment layers these days it done in two steps not one step like the old days. The first step add the layer the second one adjust the adjustment layer.  You would need to to the same in you script.  The first one adds the adjustment layer and names it without any dialog.  the seconds step sets the properties with the action displays no dialog.   You may want to record an action that add an adjustment layer.  The use Xtools script  ActionToJavascript.jsx to convert the actions two steps into a script the modify the script for use within your script and make the adjust properties step have a dialog displayed.

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 13, 2015 Jun 13, 2015

Copy link to clipboard

Copied

Found the solution. Thanks for guiding me there JJMack!

Basically as you said, the first part (for every other adjustment same thing) without a dialog box, the second part of the actual adjusting with dialog box:

...

executeAction( idMk, desc173, DialogModes.NO );

...

executeAction( idBrgC, desc14, DialogModes.ALL );

...

Not sure why your brightness / contrast function looks like that in your listener though, in mine it looks different. This is the working result:

script.PNG

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 13, 2015 Jun 13, 2015

Copy link to clipboard

Copied

Wow, ok, too happy too early. Doesn´t work.

The pop up is displayed, but when I change the parameter values, nothing happens.. Mistake?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 13, 2015 Jun 13, 2015

Copy link to clipboard

Copied

I'm dislyextrics and have a very hard time reading your stuff because your text free flow everything.  I also can not type but with two fingers and make tyos left an right.   I'm sure my scriptlisener code and your are the same when the plugin create it.  I will modify it so I can read it better and make functions out of it. replace  hard coded vars with variables use in the function .  Some of the code I posted was not created with the scriptlistener.  I recorded an action and use X's Xtools to convert the action to script code.  Some of that code will look like scriptlistener code because its action manager code.  You use a text editor the free flow everything which make it impossible for me to read.

If you use the code I posted that use  try and catch.  If an error happens the catch will catch the error and do nothing.  You will see no error massage and no change.  While you debug  when the code catches an error  you should add code to display  the error  or remove the  try catch so you see errors.

I see some code like that to alert  you and I see what look like an interactive brightness and contrast adjustment. You write the dialog displayed but nothing happens. Is The Properties palette visible with a Brightness and contrast adjustment or are you targeting a layers and adjusting a layer directly not an adjustment layer.  As I wrote I cant read what you posted well because it is flowed together and not formatted so I can read it.

Please use something like Adobe extened script toolkit editor to format the javascript code to make it more readable for me.

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 14, 2015 Jun 14, 2015

Copy link to clipboard

Copied

Ah okay, I see your situation.

I definately tried your code out, and I like the try-catch block so that no error message pops up, which is annoying aswell in my code. In my case though, it just didn´t happen anything with your version. Maybe I did something wrong on my end, since I´m completely new to script coding.

I think the main problem is that I´m not targeting the correct layer. The adjustment window pops up, but it doesn´t target the adjustment layer that I have just created.

I made some progress though, replacing one variable (desc4 in this case) with the one created (desc173) and I manage to at least change the layer mask when I have 'legacy' checked in the brightness dialog box.

This would be the code:

code.PNG

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.NO );

    }

catch(e){

        if (e.toString().indexOf(ErrStrs.USER_CANCELLED)!=-1) {;} else{alert(localize("$$$/ScriptingSupport/Error/CommandNotAvailable=The command is currently not available"));}}

  

var idBrgC = charIDToTypeID( "BrgC" );

var desc173 = new ActionDescriptor();

var iduseLegacy = stringIDToTypeID( "useLegacy" );

desc173.putBoolean( iduseLegacy, false );

executeAction( idBrgC, desc173, DialogModes.ALL );

What I somehow need to achieve is to access the values dialog box that is created afterwards, only within the first try block / the first function, like it would be normally so that it doesn´t lose the 'connection'.

Any suggestions?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 14, 2015 Jun 14, 2015

Copy link to clipboard

Copied

Scriptlistener code is not very readable. So unless you know exactly was was recorded one does not know the the code is for.   I showed a case where I recorded an action instead of using the scriptlistener plug-in. Where I recorded adding as brightness and contrast adjustment layer. I followed the recording of that step with a select all step. Then stopped the recording the action and deleted the last select all step.  The left the recording of only adding the brightness and contrast adjustment layer.  Which was recorded  in two separate actions steps The first step  added the layer which left that layer the target and the second step set the properties of the added adjustment layer.  The Second step recording is a delayed recording. You can set the properties over and over again till you get what you want. No properties setting step is recorded till you record some other step. Like Select all or perhaps even clicking stop recording.  When that even happens Photoshop will record a single set properties step.   After I record that action I user Xtools to convert the action tos a script. The script would add a hard coded brightness and contrast Adjustment layer.  The script would do the using two hard coded steps.  On add the correct adjustment layer the second set that layer properties.  You may be able to change that  script  into a function making the second step interactive. I do not know if that will work.

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jun 14, 2015 Jun 14, 2015

Copy link to clipboard

Copied

Try this..

newBCLayer();

selLayerRGB();

setBC();

function newBCLayer() {

var desc2 = new ActionDescriptor();

var ref1 = new ActionReference();

ref1.putClass( charIDToTypeID('AdjL') );

desc2.putReference( charIDToTypeID('null'), ref1 );

var desc3 = new ActionDescriptor();

var desc4 = new ActionDescriptor();

desc4.putBoolean( stringIDToTypeID('useLegacy'), false );

desc3.putObject( charIDToTypeID('Type'), charIDToTypeID('BrgC'), desc4 );

desc2.putObject( charIDToTypeID('Usng'), charIDToTypeID('AdjL'), desc3 );

try{

executeAction( charIDToTypeID('Mk  '), desc2, DialogModes.NO );

}catch(e){}

};

function selLayerRGB() {

var desc = new ActionDescriptor();

var ref = new ActionReference();

ref.putEnumerated( charIDToTypeID('Chnl'), charIDToTypeID('Chnl'), charIDToTypeID('RGB ') );

desc.putReference( charIDToTypeID('null'), ref );

desc.putBoolean( charIDToTypeID('MkVs'), false );

try{

executeAction( charIDToTypeID('slct'), desc, DialogModes.NO );

}catch(e){}

};

function setBC() {

var desc9 = new ActionDescriptor();

var ref5 = new ActionReference();

ref5.putEnumerated( charIDToTypeID('AdjL'), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );

desc9.putReference( charIDToTypeID('null'), ref5 );

var desc10 = new ActionDescriptor();

desc10.putInteger( charIDToTypeID('Brgh'), 0 );

desc9.putObject( charIDToTypeID('T   '), charIDToTypeID('BrgC'), desc10 );

try{

executeAction( charIDToTypeID('setd'), desc9, DialogModes.ALL );

}catch(e){}

};

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 15, 2015 Jun 15, 2015

Copy link to clipboard

Copied

Wow, it works. Thanks so much Philip Cord, genius right there !

Now I have to try to understand the code and apply it to all the other adjustments.. will be difficult.

Would it be ok to PM you if I have a question, Phil?

Also thanks JJMack for the patience, appreciate it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 15, 2015 Jun 15, 2015

Copy link to clipboard

Copied

Looks like Philip's solution was just to first create the adjustment layer without any dialog box, then another bit of scriptlistener code to change the values of that adjustment layer. Nice thinking.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 15, 2015 Jun 15, 2015

Copy link to clipboard

Copied

I´m finished writing the scripts for all adjustments. So far they seem working, but it would be awesome if you could correct

me if I made something wrong, don´t want to crash up the settings or something. Here´s the link to the dropbox, .rar file with ONLY textfiles in it.

Dropbox - adj scripts.rar

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jun 15, 2015 Jun 15, 2015

Copy link to clipboard

Copied

They look fine and they work for me. Good work!

Not all the scriptlistener code is produced all of the time, if it doesn't give the required code it is worth creating an action then examing the scriptlistener output as this can give extra code.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 15, 2015 Jun 15, 2015

Copy link to clipboard

Copied

LATEST

Awesome, thanks a bunch

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines