4 Replies Latest reply on Jul 6, 2012 12:23 AM by Laubender

    "app.selection[0]" – what can be done with it? (CS5)/(CS6)(JS)


      This is hopefully not a simple question – because then the answer would probably be 'no'/'nothing else'.


      What can be done with a selection? Is it posible to sort out the different contents within a selection, declare variables around them or give them names, and then continue from there?


      I have one specific idea here. I want to select two things – one is a group, and the other is a non-grouped object, and then include that object in the original group. No – not the same as selecting them and simply grouping them, that could be done by hand. I want to include an object in a previously set group without creating another one.


      It has to do with a plugin used for creating apps for mobile devices. Creating another group out of the group + item makes all previous settings assigned to the original group dissapear. Not sure if the plugin will accept this method, but it's worth a try.

        • 1. Re: "app.selection[0]" – what can be done with it? (CS5)/(CS6)(JS)
          Laubender Adobe Community Professional & MVP

          Hm. This now is pure speculation on my side, 'cause you are not telling much about the plugIn that has to do with app creation.


          From my knowledge of Adobe Digital Publishing Suite, and I cannot assume that you are using the DPS plugIns "Folio Builder" and "Overlay Creator", I can only guess, that you applied something like an effect (in terms of DPS an "overlay" function) to a group and afterwards grouping anew with a different object to a new group. Then the overlay is burried in that group and will not work as you expected.


          I never asked myself if it will damage an applied "overlay", if the object is grouped with something that has an different "overlay" effect or no "overlay" effect at all. But I will test for that situation…


          After re-reading your question you like to add the same "overlay" effect of the original group to the new group or adding a new object to the group so the effect is not lost.


          In case you are working with DPS, the overlay effects are "injected" with a method you can compare directly with the JavaScript method  insertLabel("KeyString","ValueString") and will stick to the object until the values are changed or the object (your group) will not exist any more (by un-grouping).


          So please, tell us something more about your workflow…


          It's not that easy to add an existing object to a group without un-grouping and re-grouping. And this will destroy the "injected" Key/Value-pairs of the effect.


          Here is something to think about (read the whole discussion):





          • 2. Re: "app.selection[0]" – what can be done with it? (CS5)/(CS6)(JS)
            PrntScr Level 1

            Hi Uwe,


            Thanks for contemplating around this.


            The plugin is called "Mag +" and to my knowledge it works by itself, not through the DPS, with just the functions supplied by a 'basic' InDesign application + the plugin itself.


            Yes, adding things to a group seems difficult from my very limited experience. Dave Saunders has a script, http://jsid.blogspot.se/2005/08/script-of-day-add-item-to-group.html, where he uses "Group.graphicLines.add" to add a line to a group. But that is creating an object by script, and not adding whatever is selected to it.


            Will read the post and return.

            • 3. Re: "app.selection[0]" – what can be done with it? (CS5)/(CS6)(JS)
              Laubender Adobe Community Professional & MVP

              Unfortunately Marc's script will not help in your case.


              I just tested the script of Marc Autret in answer 5 of



              with a group object that I had applied a drop shadow (a property that is unique to the group not to its memebers) and a single text frame I wanted to inject in that group.


              Adding the single text frame to the group went well, but the drop shadow of the group got lost in action…
              And as well, I fear, will vanish your special properties that the "Mag +" plugIn applied to your group.


              For testing make sure that the Group.prototype function is above the lines of code where you call the function!



              • 4. Re: "app.selection[0]" – what can be done with it? (CS5)/(CS6)(JS)
                Laubender Adobe Community Professional & MVP

                Some other thoughts:


                I don't know anything about the "Mag +" software or its inner workings or how it will apply features to the pageItems like groups.


                However, I see three ways of doing that (maybe there are some more):


                1. Apply labels to the object and work according to the labels when output


                2. Access the pageItems by their ID and store the features in a separate data base and use this for referencing
                This is not much likely, because you cannot duplicate or copy/paste a pageItem without loosing its special features; unless you provide a mechanism that checks if the item is in the data base and updates the data base in case of duplication or copy/paste events; if that is possible at all. Did not do plugIn development so far…


                3. Expanding the properties of the object with/or without providing scripting capabilities to access thiese properties and providing functions to deal with the properties


                For case 1 you could try to find out the key/value pairs of the features and writing a script to retrieve them from the group you already have and "inject" them to a new group. You could export your selection (the group) to IDMS (export to snippet) and inspect the IDMS file (it's pure text) looking for  entries like "<KeyValuePair Key="


                In case 2 you cannot do anything with scripting.


                Case 3: provided the "Mag +" documentation does not mention anything about scripting the plugIn you have no access to its features.
                But you can always ask the developer…