JS CS3 Simple Dialog to change doc starting page.
This example presents the user a dialog telling them the what their current document starting page is. The user can then change the value and update the starting page number. For some reason I'm getting a error Cannot handle the request because a modal dialog or alert is active. I have set myDialog.close(); before the if statement so should this not stop this error?
I have not added any checks to ensure a doc is open in ID yet.
var myDialog = new Window('dialog', ' Starting Pg No');
myDialog.dPgNo = myDialog.add('panel',undefined,'File details');
myDialog.dPgNo.alignChildren = 'left';
myDialog.dPgNo.myPgNo = myDialog.dPgNo.add('group');
myDialog.dPgNo.myPgNo.group = myDialog.dPgNo.myPgNo.add('group');
myDialog.dPgNo.btnGroup = myDialog.dPgNo.add('group');
with (myDialog.dPgNo){
myPgNo.group.orientation = 'column';
myPgNo.group.alignChildren = 'right';
myPgNo.group.preferredSize = [90,15];
myPgNo.group.st = myPgNo.group.add('statictext',undefined,'Your Doc starting page is:');
myPgNo.et = myPgNo.add('edittext', undefined, app.activeDocument.pages[0].name)
btnGroup.btn = btnGroup.add('button', undefined, 'Update');
btnGroup.alignment = 'right';
}
myDialog.dPgNo.btnGroup.btn.onClick = function() {
myDialog.close();
var myPagestart = myDialog.dPgNo.myPgNo.et.text;
if (app.activeDocument.pages[0].name != myPagestart){
app.activeDocument.pages[0].appliedSection.continueNumbering = false; //<-----------ESTK stops here with the error mentioned before.
app.activeDocument.pages[0].appliedSection.pageNumberStart = parseInt(myPagestart);
app.activeDocument.pages[0].appliedSection.sectionPrefix = "";
alert("Your document start page has been changed to "+myPagestart+".");
}
myDialog.show();
}
myDialog.show();