4 Replies Latest reply on Jul 21, 2011 4:29 AM by Peter Kahrel

    UI Issue

    Spitler666

      I have an issue trying to create a basic UI.

       

      The code works great in Adobe After Effects but in InDesign, I see the window flash up but then disappears.

       

      Any ideas?

       

      Thanks.

       

      Phil

       

       

       

       

       

       

      var myPalette = buildUI(this);

       

      if (myPalette != null && myPalette instanceof Window) {

      myPalette.show()

      }

       

      function buildUI (thisObject) {

       

      if (thisObject instanceof Panel) {

      var myWindow = thisObject;

      } else {

          var myWindow = new Window ("palette", "My Window");

      }

       

      // alert( myWindow) ;

       

      myWindow.myPanel = myWindow.add("group");

      myWindow.myPanel.orientation = "column";

      myWindow.myPanel.okButton = myWindow.myPanel.add("button");

      myWindow.myPanel.okButton.text = "OK";

      myWindow.myPanel.cancelButton = myWindow.myPanel.add("button");

      myWindow.myPanel.cancelButton.text = "Cancel";

       

      myWindow.layout.layout(true);

      myWindow.layout.resize();

       

      myWindow.myPanel.okButton.onClick = function () {

       

      ok_pressed();

       

      }

       

      myWindow.myPanel.cancelButton.onClick = function () {

      cancel_pressed();

       

      }

      return myWindow;

      } //function buildUI ()

       

       

      function ok_pressed(){;

      alert ("ok");

      }

       

       

      function cancel_pressed(){;

      alert ("cancelled");

      }

        • 1. Re: UI Issue
          Larry G. Schneider Adobe Community Professional & MVP

          You might try looking here

           

          www.kahrel.plus.com/indesign/scriptui-1-6.pdf

          • 2. Re: UI Issue
            Peter Kahrel Adobe Community Professional & MVP

            In InDesign (but not in After Effects) you have to target an engine for palettes to work. Add this line at the top of your script:

             

            #targetengine "session";

             

            Peter

             

            (That pdf might still be useful : )

            • 3. Re: UI Issue
              PhilSpitler

              This worked great thanks.

               

              One thing I cannot figure out is how to make a dockable UI.

               

              In After Effects, I simply put the script in the "ScriptUI" folder and it appears as a dockable script.

               

              Is there a way to do something similar in InDesign?

               

              Or as a workaround, could I get my script to launch as InDesign starts.

               

              Thanks.

               

              Phil

              • 4. Re: UI Issue
                Peter Kahrel Adobe Community Professional & MVP

                > In After Effects, I simply put the script in the "ScriptUI" folder and it appears as a dockable script.

                > Is there a way to do something similar in InDesign?

                 

                I don't think so.

                 

                > could I get my script to launch as InDesign starts.

                 

                Yes. Place in the Startup Scripts folder, which is a subfolder of the Scripts folder.

                 

                Peter