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

How to check if a internal modal dialog is open?

Community Beginner ,
May 20, 2014 May 20, 2014

Hey Folks,

I am using a app.scheduleTask as an interval to look if the contents of a folder have changed in the background.

This works well enough but if the user opens up an internal modal dialog (e.g. compositions settings), AE throws an error:

modalDialogError.jpg

I have not been able to find any system event or variable to check if AE is currently busy with a modal dialog.

At the moment the user needs to restart the complete script, since the error stops the script from further execution.

Is there any option to check for modal dialogs?

Otherwise app.scheduleTask is pretty flawed as it causes every script to break if the user enters a modal dialog.

Cheers,

Matthias

TOPICS
Scripting
2.0K
Translate
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 ,
May 20, 2014 May 20, 2014

To prevent this error from showing up, you will need to use a try{}catch(e){} in your code.

As to keep the scheduled task running there is nothing you can do (since CC) as you could have used a flash timer in CS5/6.

More here :

Translate
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
Community Beginner ,
May 20, 2014 May 20, 2014

Hi,

thanks for the quick reply.

Sadly, adding a try and catch around the app.schedule code didn't do the trick.

app.scheduleTask('try{ check(); }catch(e){}',2000,true);

This will still stop the script from execution and result in the same error message.

The flash timer thingy is a nice idea but I need AECC support.

Cheers,

Matthias

Translate
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
New Here ,
Mar 14, 2018 Mar 14, 2018

Has anyone been able to find a solution to this? Problem still persists in CC.

Translate
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
Explorer ,
Apr 17, 2019 Apr 17, 2019

No, you are wrong - the whole script won't even start as soon as there is some Modal Dialog thus your code would not be executed: "Can not run a script while a modal dialog is waiting for response"

Translate
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
New Here ,
Jun 20, 2018 Jun 20, 2018

Same problem here, when using app.scheduleTask() .

By only using app.scheduleTask('anEmptyFunction()', 200, true); with `function anEmptyFunction() { }`, It happens that I get that error if I do open some other projects.

Is it possible to get the error message of an hidden internal modal ?

Translate
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
Enthusiast ,
Jun 22, 2018 Jun 22, 2018

You can use

app.isUISuppressed

to check whether there is a dialog active,

Translate
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
Explorer ,
Apr 17, 2019 Apr 17, 2019

But according to http://docs.aenhancers.com/  there is no such option for app object?

Anyway, it works as long it is FALSE, but once it should be TRUE nothing happens because of...the exact problem it was testing against: "Can not run a script while a modal dialog is waiting for response" LOL, so no use I would say cos the script is simply never fired up once it is TRUE thus it has no way to check it.

I did try it this way (dos not work, of course: once TRUE it breaks the code so it does not even get to this statement):

var checkTask = app.scheduleTask("if(!app.isUISuppressed){check();}", 5000, true);

Translate
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
Explorer ,
Apr 17, 2019 Apr 17, 2019
LATEST

Well, I think solution to this Modal Dialog thing cannot be solved via script as any script is immediately terminated as soon as there is some Modal Dialog issue (ehm, talking/meaning specifically "perpetual" app.scheduleTask() which becomes automatically broken this way that is it won't continue once Modal Dialog issue is gone)

Translate
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