Skip to main content
Inspiring
March 6, 2018
Question

How to add a dialog?

  • March 6, 2018
  • 1 reply
  • 269 views

I want to add a easy dialog like this:

function menuItemHandler4ClearCache(event) {

    var myDialog = app.dialogs.add({name:"Clear Cache Confirm", canCancel:true});

    with(myDialog){

        staticTexts.add({staticLabel: "Are you confrim to clear cache?"});

    }

    var myResult = myDialog.show();

    if(myResult == true){

        myDialog.destroy();

        //remove cache folder.

    }else{

        myDialog.destroy();

    }

}

But this code is not work, is any problem here?

and how to add a icon to dialog like in image?

please help me, thanks a lot!!

This topic has been closed for replies.

1 reply

Loic.Aigon
Legend
March 7, 2018

See Confim Dialog:

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#global.html

if ( confirm("Are you confrim to clear cache?", true, "Clear Cache Confirm") ) {

alert("you said yes");

}

But in case you need more advanced dialog, I would switch to ScriptUI over Dialog Class.