• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Cannot handle the request because a modal dialog or alert is active

Contributor ,
Apr 13, 2016 Apr 13, 2016

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

TOPICS
Scripting

Views

1.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

People's Champ , Apr 14, 2016 Apr 14, 2016

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

Ozalto | Productivity Oriented - Loïc Aigon

Votes

Translate

Translate
Enthusiast ,
Apr 13, 2016 Apr 13, 2016

Copy link to clipboard

Copied

Use 'palette' instead of 'dialog' and place '#targetengine "session";' this line at the top of your script.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Apr 14, 2016 Apr 14, 2016

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Apr 14, 2016 Apr 14, 2016

Copy link to clipboard

Copied

did you used '#targetengine "session";' as Chinna said? i tried and it is working fine

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Apr 14, 2016 Apr 14, 2016

Copy link to clipboard

Copied

LATEST

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

Ozalto | Productivity Oriented - Loïc Aigon

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines