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

Help with tabs in the scriptUI

Engaged ,
Jan 22, 2018 Jan 22, 2018

Copy link to clipboard

Copied

Hello friends!

Normally when we open a dialog box that contains some open, it is normal that when we select one of these tabs, show its respective interface content.

My question would be:

Is there any possibility to execute a second function when I select a tab and show its contents:

Example:

A dialog box has 3 tabs "Color", "Levels" and "Curves"

If I select the "Levels" tab also perform something like that, it may be an Alert warning: "You have selected the Levels tab".

var dlg = new Window ("dialog", "Abas", [0,0,0,0]);

dlg.size = [240, 120]

dlg.location = [415, 230]

var tpanel = dlg.add ("tabbedpanel" ,[10,10,0,0],);

tpanel.size = [220,100];

dlg.location = [10, 10];

var general = tpanel.add ("tab", [0,0,0,0], "Color");

var images = tpanel.add ("tab", undefined, "Levels");

var img_options = images.add ("panel", undefined, "Image Options");

var buttons = dlg.add ("group");

buttons.add ("button", undefined, "Export", {name: "ok"});

buttons.add ("button", undefined, "Cancel");

var images1 = tpanel.add ("tab", undefined, "Curves");

var img_options = images1.add ("panel", undefined, "Image Options");

var buttons = dlg.add ("group");

buttons.add ("button", undefined, "Export", {name: "ok"});

buttons.add ("button", undefined, "Cancel");

tpanel.selection = 0;

dlg.center();

dlg.show ();

TOPICS
Actions and scripting

Views

1.7K

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

LEGEND , Jan 23, 2018 Jan 23, 2018

IMPORTANT: you probably saved script and ran from Photoshop or kept first dlg preceeded by var (though I missed it) if ran from ESTK with targeted Photoshop; it is why it worked. But if you've ran it from ExtendScript ToolKit without var in front of first dlg then you got error !

Here's example of that you wanted (replace alerts with your stuff):

tpanel.onChange = function() {

     if (tpanel.selection.text == tpanel.children[0].text) {

          alert('Your "Colors" function')

     }

     else if(tpa

...

Votes

Translate

Translate
Adobe
LEGEND ,
Jan 22, 2018 Jan 22, 2018

Copy link to clipboard

Copied

tpanel.onChange = function() {alert(tpanel.selection.text)}

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
Engaged ,
Jan 22, 2018 Jan 22, 2018

Copy link to clipboard

Copied

Hi Kukurykus , thanks for the quick support!

Just one more question:

How do I select only one of the tabs, example "Levels"?

This information is fundamental to the progress of my project.

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
LEGEND ,
Jan 22, 2018 Jan 22, 2018

Copy link to clipboard

Copied

tpanel.onChange = function() {if (tpanel.selection.text == txt = tpanel.children[1].text) alert(txt)}

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
Engaged ,
Jan 22, 2018 Jan 22, 2018

Copy link to clipboard

Copied

HiKukurykus thanks again!

Please, sorry for my lack of knowledge!

My real goal would be to replace this alert message with a function. but I can not understand your code:

example:

By clicking on the "Level" tab,

Perform this function:

dlg.size = [240, 320]

(Increase window height)

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
LEGEND ,
Jan 22, 2018 Jan 22, 2018

Copy link to clipboard

Copied

Replace 2 lines on top of code you posted higher to:

(function shw(v) { 

     dlg = new Window ("dialog", "Abas", [0,0,0,0])

     dlg.size = [240, v]

then last line of that code change to these lines:

     tpanel.onChange = function() {if (tpanel.selection.text == tpanel.children[1].text && dlg.size[1] < 320) dlg.close()} 

     dlg.show ()

     if (dlg.size[1] < 320) shw(320)

})(120)

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
Engaged ,
Jan 23, 2018 Jan 23, 2018

Copy link to clipboard

Copied

Many thanks for the feedback Kukurykus! It was 100% functional: For you this seems very easy. I confess that it is not easy to understand the way you program, so that you can add other functions in other guides!

I plan to add other functions to other tabs in future projects!

It would be interesting a simplification type:

When clicking on a tab, Photoshop will do a task through a Script:

My problem is in this part:

I do not know if this is possible and if you would still be willing to help me:

You could then write a comment like:

When you select one of the tabs: perform some function

You could create a line with a comment:

// Put here the script that performs some function:

This is fundamental

Eternally grateful!

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
LEGEND ,
Jan 23, 2018 Jan 23, 2018

Copy link to clipboard

Copied

IMPORTANT: you probably saved script and ran from Photoshop or kept first dlg preceeded by var (though I missed it) if ran from ESTK with targeted Photoshop; it is why it worked. But if you've ran it from ExtendScript ToolKit without var in front of first dlg then you got error !

Here's example of that you wanted (replace alerts with your stuff):

tpanel.onChange = function() {

     if (tpanel.selection.text == tpanel.children[0].text) {

          alert('Your "Colors" function')

     }

     else if(tpanel.selection.text == tpanel.children[1].text) {

          if (dlg.size[1] < 320) dlg.close()

          else {

               alert('Your "Levels" function')

          }

     }

     else {

          alert('Your "Curves" function')

     }

}

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
Engaged ,
Jan 23, 2018 Jan 23, 2018

Copy link to clipboard

Copied

Wow that's amazing! You are a TRUE GENIUS and Gentiu. Now I am very happy and content.

Many thanks for your dedication and for sharing your knowledge friend Kukurykus

Forever grateful to you!

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
Participant ,
Sep 07, 2022 Sep 07, 2022

Copy link to clipboard

Copied

LATEST

This helped me ! Thank you Kukurykus.

 

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 ,
Jan 24, 2018 Jan 24, 2018

Copy link to clipboard

Copied

You may want to download and install the image processor Pro script the look ate the code for processing the File type tabs. Its default come with three tabs however the dialog allows you to delete and add tabs to a max of 10 Tabs. You can switch between tabs and see what you have in them and change the settings that are in the tabs..   You can even save configurations you edit.

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
Participant ,
Sep 07, 2022 Sep 07, 2022

Copy link to clipboard

Copied

This helped me. Thank you 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