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

how to add buttons in script, which on click run different codes?

Engaged ,
Nov 03, 2013 Nov 03, 2013

Copy link to clipboard

Copied

If we run script then it should display 6 button along with ok, cancel button. If we click on button1 then the coding assciated with button1 should execute and so on.

button1

button2

button3

button4

button5

button6

Ok Cancel.

Virender

TOPICS
Scripting

Views

1.0K

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

Community Expert , Nov 04, 2013 Nov 04, 2013

// DialogSimpleButton.jsx

// http://forums.adobe.com/thread/1327372?tstart=0

// how to add buttons in script, which on click run different codes?

// regards pixxxelschubser

function SimpleDialog() {

var w = new Window('dialog', '');

this.windowRef = w;

w.orientation = "column";

btn1 = w.add('button',undefined,'Button 1');

btn2 = w.add('button',undefined,'Button 2');

btn3 = w.add('button',undefined,'Button 3');

btn4 = w.add('button',undefined,'Button 4');

btnOK = w.add('button',undefined,'OK');

btnCancel = w.

...

Votes

Translate

Translate
Adobe
Community Expert ,
Nov 03, 2013 Nov 03, 2013

Copy link to clipboard

Copied

Only by using a palette with BridgeTalk.

Here you can see a simple example:

http://forums.adobe.com/message/4844127#4844127

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 ,
Nov 04, 2013 Nov 04, 2013

Copy link to clipboard

Copied

Hi,

I am sorry I was not clear enough to explain my requirement. the codes which will exeute will remain in a single scirpt. all in all only one script file. I am new for create button and assign code to that button so any help will be great.

button1  // alert("button1")

button2  // alert("button2")

button3  // alert("button3")

button4  // alert("button4")

button5  // alert("button5")

button6  // alert("button6")

Ok Cancel.

If i click on button2 then respective code should exceute e.g. alert("button2") in this case.

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 ,
Nov 04, 2013 Nov 04, 2013

Copy link to clipboard

Copied

// DialogSimpleButton.jsx

// http://forums.adobe.com/thread/1327372?tstart=0

// how to add buttons in script, which on click run different codes?

// regards pixxxelschubser

function SimpleDialog() {

var w = new Window('dialog', '');

this.windowRef = w;

w.orientation = "column";

btn1 = w.add('button',undefined,'Button 1');

btn2 = w.add('button',undefined,'Button 2');

btn3 = w.add('button',undefined,'Button 3');

btn4 = w.add('button',undefined,'Button 4');

btnOK = w.add('button',undefined,'OK');

btnCancel = w.add('button',undefined,'Cancel');

btn1.onClick = function() {alert("Button 1");};

btn2.onClick = function() {alert("Button 2");};

btn3.onClick = function() {alert("Button 3");};

btn4.onClick = function() {alert("Button 4");};

defaultElement = btnOK;

cancelElement = btnCancel;

btnOK.active = true;

btnOK.onClick = function() {

    stuff = "your stuff";

    w.close();

    }

w.show();

}

var stuff = null;

SimpleDialog ();

if (stuff) alert(stuff);

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 ,
Nov 04, 2013 Nov 04, 2013

Copy link to clipboard

Copied

LATEST

Thanks for the help again (previous help on 6th sept).

i will add my code in this script to complete my requirement. Lets see............

Regards

Virender

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