Skip to main content
dublove
Legend
Mar 25, 2026 2:37 PM UTC
Question

How do I display variable values in the panel?

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

 

    14 replies

    rob day
    Community Expert
    Community Expert
    Mar 25, 2026 5:19 PM UTC

    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
    }

     

     

     

    Translate
    dublove
    dubloveAuthor
    Legend
    Mar 25, 2026 5:22 PM UTC

    ​@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.

     

    Translate
    rob day
    Community Expert
    Community Expert
    Mar 25, 2026 6:08 PM UTC

    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)

     

     

    Translate
    Community Expert
    Mar 25, 2026 3:07 PM UTC

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

    Translate
    -Manan
    dublove
    dubloveAuthor
    Legend
    Mar 25, 2026 4:15 PM UTC

    I can't find any examples to refer to.

    Translate
    Community Expert
    Mar 25, 2026 4:46 PM UTC

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

     

    Translate
    -Manan