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

How to avoid modal dialogs from blocking script execution

New Here ,
Feb 28, 2008 Feb 28, 2008
I tried to import text files with tagged text using a script. But if the tagged text refers to a typeface I don't have installed, it stops, producing the error: "Cannot handle the request because a modal dialog or alert is active." But I don't care if fonts are missing at this point.

Is there a way to avoid this?
TOPICS
Scripting
4.2K
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 Expert ,
Feb 28, 2008 Feb 28, 2008
Add this line to your script:

app.scriptPreferences.userInteractionLevel =
UserInteractionLevels.neverInteract;

It suppresses all dialogs. Be sure to add this line at the end of your script:

app.scriptPreferences.userInteractionLevel =
UserInteractionLevels.interactWithAll;

Or even better, use it in the catch phrase of a try-catch construction.

Peter
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 ,
Aug 11, 2010 Aug 11, 2010

I had a script running fine called from a Windows service using doScript.  All of a sudden it stopped working throwing the error "Cannot handle the request because a modal dialog or alert is active".  I tried setting the userInteractionLevel as described here in the script with the same result.  I tried setting the userInteractionLevel on the com object in my c# code with the same result.  I even tried making a test script that just creates a new document.  I ran it in the UI with no problem, but got the same result when trying to run it from the service.  I even uninstalled and reinstalled CS5.  I don't see an option in the CS5 com object to show the window when running a script.  I'm out of ideas and very stuck.  Can anyone help?

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 ,
Aug 11, 2010 Aug 11, 2010

I know you said you already tried it, but I would try running the script with indesign open so you can see what the problem is.  Dialogs can still apear, even after you say 0 interaction, it happenes.  Maybe your script creates a file dialog or something?

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 ,
Aug 11, 2010 Aug 11, 2010

Did that. No luck.  I tried a test script whose entire code is below.  It runs fine in the UI, but produces the same error when executed from COM.

var doc = app.documents.add( true, app.documentPresets.itemByName( "[Default]" ) );

I even did a bare metal reinstall of CS5.

The same script & C# invocation of it works fine on a server I'm using for testing.

Is there a way to call doScript from COM and have it show the window?  I believe there used to be in CS3.

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 ,
Aug 18, 2010 Aug 18, 2010

In case anyone else experiences this, I hope to save you the week of pain it caused me.  It turns out the dialog was about recovering a document.  The only was I could get past it was a trick our IT guy figured out.  He showed me how to run Windows as the System user.  Once I did that, I was able to run InDesign as the System user and manually dismiss the dialog.

Here's how to do it in XP: http://alieneyes.wordpress.com/2006/10/23/how-to-gain-access-to-system-account-the-most-powerful-acc...

Here's what our IT guy figured out for Vista/Win7:

  1. Download and install PSTools from Microsoft: http://technet.microsoft.com/en-us/sysinternals/bb896649.aspx
  2. Launch cmd.exe as administrator

  3. Run psexec -i -s c:\windows\system32\cmd.exe

  4. Kill explorer.exe

  5. In new command window type explorer.exe

Happy trails

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

Does not work in AE CC2017 - nothing like that exists there!

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 ,
May 17, 2017 May 17, 2017

For anyone who comes across this looking for how to suppress errors in Photoshop CC, I found this worked:

app.displayDialogs = DialogModes.NO;

// Your code

app.displayDialogs = DialogModes.ERROR;

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