4 Replies Latest reply on Feb 19, 2017 5:33 PM by Nelway

    Accessing controls within a panel through scripting

    Nelway Level 1

      Hello,

       

      I'm using a script to open the Media panel in InDesign CC 2015, but once it opens, I have no idea how to access the panel controls programmatically.

       

      app.menuActions.itemByID(84228).invoke();

       

      The Media panel contains a checkbox and a dropdown box.  Is it possible to access these controls via scripting once the panel is opened?

       

      Thanks

        • 1. Re: Accessing controls within a panel through scripting
          Laubender Adobe Community Professional & MVP

          What do you want to do exactly?

          If you want to get access to e.g. a placed movie's properties look up the object's properties and methods:

          Adobe InDesign CS6 (8.0) Object Model JS: Movie

           

          Regards,
          Uwe

          • 2. Re: Accessing controls within a panel through scripting
            Nelway Level 1

            Uwe,

             

            Thanks for your reply.  I was trying to find an alternative way to setting the poster image on SWF files.  I have not been able to do this with the movie object properties.  Using the movie property moviePosterType = MoviePosterTypes['FROM_MOVIE'] works great with MP4 files, but throws an error if the movie is a SWF.

             

            Error Number 81926: The poster image could not be changed to the requested image.

             

            However, if I use the Media panel to manually select this option (labeled "From Current Frame") from the dropdown, then the moviePosterType is applied correctly.

             

            Thanks

            • 3. Re: Accessing controls within a panel through scripting
              Laubender Adobe Community Professional & MVP

              Hi Nelway,

              I tried something with a menuAction.

              At least there is a string for this available: "$ID/$$$/PosterOption/Frame"

              But a menu action with that name is not valid, if the media panel is showing up and a movie frame is selected.
              Maybe I did not place the right kind of swf ? You could have success with it and using invoke() on the menuAction if it is valid.

               

              app.menuActions.itemByName("$ID/$$$/PosterOption/Frame").isValid;
              // returns false with me
              

               

              Two ideas:

              1. Assign a new posterFile directly to the movie with movie.posterFile = "fullPathOfAnImageString".

              2. Relink the StandardSwfPoster.jpg showing in the Links panel to a poster file image.

              The problem would be providing a new poster file from the movie.

               

              Regards,
              Uwe

              • 4. Re: Accessing controls within a panel through scripting
                Nelway Level 1

                Uwe,

                 

                Thanks for your suggestions.  I tried the string on different swf files, but unfortunately, the results were also invalid.  The only way to have the string return true was to change it to "$ID/$$$/PosterOption/None".  I only did this for testing purposes.  Although the string now returned true, the movie poster did not change from STANDARD to NONE upon invoking the menu action,

                 

                app.menuActions.itemByName("$ID/$$$/PosterOption/None").invoke();

                 

                I think I'm going to have to go with your idea #1.  Although it will take a little longer to create poster images separately and assign file paths to them as you suggested, in the long run it may be faster than having to manually select the "Current Frame" option from the Media panel dropdown on every swf file.

                 

                Thanks again for all your help!