Skip to main content
dublove
Legend
March 25, 2026
Question

How do I display variable values in the panel?

  • March 25, 2026
  • 2 replies
  • 71 views

I'm trying to display the values of A and B at the bottom of the panel as a hint.
AValue and BValue are the variables being read.

This is how it currently looks; how can I modify it to display the variable values?

Thanks.

    with (theDialog.dialogColumns.add()) {
staticTexts.add({ staticLabel: "[A B]:" });
}
with (theDialog.dialogColumns.add()) {

staticTexts.add({ staticLabel: 'AValue BValue' });
}

 

    2 replies

    rob day
    Community Expert
    Community Expert
    March 25, 2026

    Hi ​@dublove , If you are using the built in dialog class you can use dropdowns.add():

     

    makeDialog();

    var dd;
    function makeDialog(){
    //the list to display (an array of strings)
    var dlist = ["A", "B"]

    var theDialog = app.dialogs.add({name:"Choose an Item", canCancel:true});
    with(theDialog){
    with(dialogColumns.add()){
    with(dialogColumns.add()){
    //the lists lable
    staticTexts.add({staticLabel:"Choose A or B: "});
    }
    with(dialogColumns.add()){
    //the dropdown
    dd = dropdowns.add({stringList:dlist, selectedIndex:0, minWidth:80});
    }
    }
    }
    if(theDialog.show() == true){
    //the selected item
    dd = dlist[dd.selectedIndex]
    main();
    theDialog.destroy();
    }
    }


    function main(){
    alert("Chosen Item: " + dd);
    //Do something with the result
    }

     

     

     

    dublove
    dubloveAuthor
    Legend
    March 25, 2026

    @rob day 

    I don't want a drop-down list.
    I just need to display the value of `lo`—just display it; I won't be modifying this value later.
    It's a static reference.

    just like this:

    I've included a code sample in another reply below.

     

    rob day
    Community Expert
    Community Expert
    March 25, 2026

    If you are not looking for user interaction why not use a simple alert?

     

    var item = app.activeDocument.selection[0]; //当前 选中项
    var cpp = item.parentPage.marginPreferences.columnsPositions;
    lo = cpp[cpp.length - 1];
    alert("[typeArea Column]: "+ lo)

     

     

    Community Expert
    March 25, 2026

    The editbox has a text property use that to set the text of the statictext field.

    -Manan
    dublove
    dubloveAuthor
    Legend
    March 25, 2026

    I can't find any examples to refer to.

    Community Expert
    March 25, 2026

    Lets say if the editbox is referenced by editOne and editTwo variable then the value can be accessed via

    editOne.text

    So the final code might become something like

    staticTexts.add({ staticLabel: editOne.text + " " + editTwo.text });

     

    -Manan