Skip to main content
Participating Frequently
January 28, 2011
Answered

doScript Execution Error with GUI

  • January 28, 2011
  • 1 reply
  • 648 views

Dear all,

I am facing a problem, I made a dialog box and several Checkbox options in that, and for every checkbox i just wan to run an script.

but it shows an error after clicking ok button, The error is

"Can not handle the request because a modal dialog or alert is active"

here is my code

function ps()

{

var res =

"dialog{\

orientation:'column',\

alignChildren:'left',\

img:Image{\

size:[130,90]\

}\

xmlot:Panel\

{\

xml:Group{\

orientation:'row',\

s:StaticText {text:'Select For XML Export'}\

b: Checkbox{text:'Word Out From Index', alignment:'left'}, \

c: Checkbox{text:'Index Out With Page Number', alignment:'left'}, \

d: Checkbox{text:'XML Out', alignment:'left'}, \

}\

},\

buttons: Group { orientation: 'row', alignment: 'right', \

okBtn: Button { text:'OK', properties:{name:'ok'} }, \

cancelBtn: Button { text:'Cancel', properties:{name:'cancel'} } \

} \

}";

var win = new Window(res,"Utility");

win.center();

win.img.icon = File("/InDesign/logo.jpg");

win.buttons.okBtn.onClick = function ()

{

if(app.documents.count()>0)

{if(win.xmlot.xml.b.value==true)

{app.doScript (new File("/InDesign/wo.jsx"), ScriptLanguage.JAVASCRIPT);}

if(win.xmlot.xml.c.value==true)

{app.doScript (new File("/InDesign/Generation.jsx"), ScriptLanguage.JAVASCRIPT);}

if(win.xmlot.xml.d.value==true)

{app.doScript (new File("/InDesign/Export.jsx"), ScriptLanguage.JAVASCRIPT);}

}

}

win.buttons.cancelBtn.onClick = function (){

win.close (true);

}

win.show();

}

This topic has been closed for replies.
Correct answer tomaxxi

Hey!

You have to move function that is executed when you click OK outside the dialog.

--

tomaxxi

1 reply

tomaxxi
tomaxxiCorrect answer
Inspiring
January 28, 2011

Hey!

You have to move function that is executed when you click OK outside the dialog.

--

tomaxxi

Harbs.
Legend
January 28, 2011

Yup.

To rephrase Marijan's answer:

The modal dialog that is open is your own!

You need to close it before you execute any code which touches the InDesign-specific part of the DOM...

Harbs

Robin_dvAuthor
Participating Frequently
January 28, 2011

Answered