Copy link to clipboard
Copied
I cannot work out for the life of me why I am getting this message when 'Cannot handle the request because a modal dialog or alert is active'. I have simplified my code down to replicate the issue.
All I want to do is have a dialog box that allows me to modify elements on the page... But it does not seem to allow it. I must be missing something simple.
var selection = app.activeDocument.selection[0];
dialog = new Window('dialog');
var button = dialog.add('button', undefined, 'Resize');
button.onClick = function() {
selection.geometricBounds = [0, 0, 10, 10];
};
dialog.show();
If you use "dialog", then you have to quit the modal state to interact with the app. Thta's done by closing the dialog.
var w = new Window('dialog');
var v = w.add ('edittext');
var b = w.add('button');
b.onClick = function(){
w.close(1);
}
if (w.show()==1) alert (v.text);
Or switch to mom modal dialogs as otherly suggested...
Loic
Copy link to clipboard
Copied
Use 'palette' instead of 'dialog' and place '#targetengine "session";' this line at the top of your script.
Copy link to clipboard
Copied
So you cant use a dialog to do this? Also I tried using a Palette... But I keep haveing this issue where the ballet is behind the main indesign window... So you cant see anything. Do you know how I can fix that?
Copy link to clipboard
Copied
did you used '#targetengine "session";' as Chinna said? i tried and it is working fine
Copy link to clipboard
Copied
If you use "dialog", then you have to quit the modal state to interact with the app. Thta's done by closing the dialog.
var w = new Window('dialog');
var v = w.add ('edittext');
var b = w.add('button');
b.onClick = function(){
w.close(1);
}
if (w.show()==1) alert (v.text);
Or switch to mom modal dialogs as otherly suggested...
Loic