36 Replies Latest reply on Mar 6, 2013 4:21 AM by davidblishen

    [CS4/5][JS] Script causes InDesign to crash




      I'm having a bit of an issue with some InDesign scripting i'm working on, and wonder if anyone else has had the same issue.


      I have a script that uses app.dialog to prompt for user information.  It then takes the result of that dialog, and uses it in the script.  Pretty standard so far, and if i run this from the scripts panel, or from ESTK, it works fine.  If I set it up as a Script Menu Action, when I run the script via the menu, it executes, then crashes InDesign.


      I have tried this with multiple dialog's, and each time a dialog is called from a SMA, InDesign crashes.  The following code is fairly pointless, but will cause InDesign to crash when the SMA is run.


      //Test script will cause InDesign to crash when the SMA is invoked
      //Daniel Cole
      //Wed Jun 09 2010 13:26:47 GMT-0400
      #targetengine "session"
      //set up the SMA and eventListener
      var saTest = app.scriptMenuActions.add("Test SMA");
      var elTest = saTest.eventListeners.add("onInvoke", function()
      //Check for the menu, and create it if it doesn't exist
          var menuTest = app.menus.item("$ID/Main").submenus.item("Test");
      catch (e){
          var menuTest = app.menus.item("$ID/Main").submenus.add("Test");
      //test function
      //creates a dialog box with a text edit box
      //returns the content of the text edit box
      function testFunc(){
           testDialog = app.dialogs.add({name:"Enter Text:", canCancel:true});
                          var getTextField = textEditboxes.add({editContents: "Test Text", minWidth:250});
           testResult = testDialog.show()
           if(testResult == true){
                var testText = getTextField.editContents;
                return testText;
                return "No Text Entered";


      I've tried this on CS4 and CS5, on multiple installs, and it crashes every time.  Can anyone else replicate this?  Is this a known issue?  Is there any way to work around it?




      Daniel Cole
      Electronic Prepress and Automation Specialist
      Disc Makers