0 Replies Latest reply on Mar 24, 2014 10:36 AM by JonnyDL

    Dialog open error?

    JonnyDL Level 1

      I have a document open. the dialog will allow the user to select from two radio button options. once the user chooses one. On the set button It wil take the choice (into another function), and set guides onto the document (and peform other indesign settings).

      Once I hit set and try and make some document settings

       

           *a test command*

          var bleedLayer = myDoc.layers.item("Bleed Guides")

          bleedLayer.remove();

       

       

      I get a open dialog or alert error.  Im closing the window, why dose it still appears to be open. Is it the way I have structured my code?

      Suggestion on how to get the document to build guides, after the selection, and close of window

       

      I had submitted this in a different form before, I been researching/learning but I can't seem to find the answer.

       

      #target "InDesign"

      function myDialog()

      {

      var bleedDialog=new Window("dialog", "Check The Bleed");

      var infopanel = bleedDialog.infoPnl = bleedDialog.add("panel", undefined, "Document Info");

      var infoGroup = bleedDialog.infoPnl.add ("group");

      var radioGroup = bleedDialog.add ("group");

      var choiceGroup = bleedDialog.add ("group");

       

       

      bleedDialog.orientation="row"

       

       

      var docname = infoGroup.add("statictext", undefined, "Doc Name:     ")//+fileName);

      var type = infoGroup.add("statictext", undefined, "Pub Type:       ")//+pubtype);

      var docwidth = infoGroup.add("statictext", undefined, "Width:            ")//+ myPageWidth +'"');

      var docheight = infoGroup.add("statictext", undefined, "Height:          ")//+ myPageHeight +'"');

      var bleedArea = infoGroup.add("statictext", undefined, "Bleed area: ")//+bleedDepth );

       

       

      infopanel.margins=[10,20,10,20]

      docname.alignment = "left";

      type.alignment = "left";

      docwidth.alignment = "left";

      docheight.alignment = "left";

      with (infoGroup)

      {

      infoGroup.orientation = "column";

      infoGroup.spacing ="6";

      }

       

       

       

       

      var justGuides = radioGroup.add("radiobutton", undefined, "Guides");

      var justMarkers = radioGroup.add("radiobutton", undefined, "Bleed Fills");

      with (radioGroup)

      {

      radioGroup.orientation = "column";

      radioGroup.spacing ="10";

        justGuides.alignment = "left"

        justMarkers.alignment = "left"

        justMarkers.spacing = "5";

      }

      justGuides.value = true;

       

       

      var okbtn = radioGroup.add("button", undefined, "Set")

      var stopbtn = radioGroup.add("button", undefined, "Cancel")

       

       

      okbtn.onClick =function ()

      {

      if (justGuides.value ==true)

          {bleedDialog.close(); var choice = "guides"; GuideChoice(choice)}

         else

         {bleedDialog.close(); var choice = "Markers"; GuideChoice(choice)}

      }

      bleedDialog.show();

      }

       

       

      myDialog ()

       

       

      function GuideChoice(choice){alert (choice);var myDoc = app.documents[0];

           var bleedLayer = myDoc.layers.item("Bleed Guides")

          bleedLayer.remove();   

          }

       

      Help!