6 Replies Latest reply on Mar 25, 2013 4:35 AM by Michael Rosenstein

    Platziertes Snippet ungreifbar

    Michael Rosenstein

      Hallo,

       

      mein InDesign benimmt sich seltsam: wenn ich ein Snippet (.inds) mit dem Skript platziere

       

      var myObject = app.documents[0].pages[0].place(myFile,[x, y]);

       

      hat myObject-Array immer 0 Elemente.

       

      Woran kann das liegen?

       

      Ich benutze InDesign CS3 (5.04) Windows Version .

        • 1. Re: Platziertes Snippet ungreifbar
          Laubender Adobe Community Professional & MVP

          @Michael – we already had that on the other thread at the HDS forums. So it seems to be a good move to present it to a wider audience.

           

          For all English reading scripters:


          Michael's problem is, that if he is placing an INDS file (CS3 Snippet in INX format) by script, the Object that is returned  is always of length 0. This is unusual. The length property should be  1 (or greater) since the placed snippet contains at least one single page item.

          However, I cannot confirm that observation. But I'm on Mac OSX with InDesign CS3 (v5.0.4), so it may well be a bug in the Windows version.

           

          Can someone test the above script snippet with InDesign CS3 on Windows 7?

           

          Btw. Placing InDesign files with the above code is no problem for Michael. In this case "myObject" does not loose its length property (or whatever the problem is).

           

          Uwe

          • 2. Re: Platziertes Snippet ungreifbar
            Michael Rosenstein Level 1

            Thanks again for your participation, Uwe. One correction: my snippets are not .INX but .INDS.

             

            I noticed one more thing, that my InDesign doesn't do: EventListener 'keydown' doesn't work, too.

             

            I tried both cases with the trial version of CS6 - no problems.

             

            Maybe my Creative Suite installation is corrupt? I think about reinstalling it but I cannot do it until Tuesday.

            • 3. Re: Platziertes Snippet ungreifbar
              Laubender Adobe Community Professional & MVP

              @Michael – you have provided further information about your INDS file at:

               

              http://www.hilfdirselbst.ch/gforum/gforum.cgi?post=510309#510309

               

              In essence: your INDS file contains one single Group object. And for that kind of file the method place() seems to return nothing. At least this is true for InDesign CS3 and CS4.

               

              So you detected a bug here…

               

              In CS5 and above all is working well. Just tested.

               

              Uwe

              • 4. Re: Platziertes Snippet ungreifbar
                [Jongware] Most Valuable Participant

                Uwe, are you sure that this is a "bug"?

                 

                For both Application and Document, I have for CS3, CS4, CS5 *and* CS6:

                 

                void place (fileName: varies[, showingOptions: bool=false][, withProperties: Object])

                 

                The others, all physical objects, all have this:

                 

                Array of any place (fileName: File[, showingOptions: bool=false][, withProperties: Object])

                 

                I don't think it matters what's inside the snippet file.

                 

                (The difference in the fileName parameter seems to lie in the fact that app and doc can also accept an array, while single objects only accept a single file.)

                • 5. Re: Platziertes Snippet ungreifbar
                  Laubender Adobe Community Professional & MVP

                  @Jongware – ok, I have to see into this.
                  Maybe we can call it a hidden feature not well documented then? ;-)
                  Seeing a "bug" in this could be too harsh…

                   

                  And: obvisously It does matter what's in the file.
                  I did three tests:

                   

                  1. Snippet with one single rectangle
                  2. Snippet with a couple of rectangles (not grouped)

                   

                  3. Snippet with a single group (a couple of rectangles)

                   

                  In InDesign CS3 and CS4 no 3 did fail, where in CS5 and above all 3 were good.

                  No 1 and 2 are working in CS3 and above.

                   

                  Though no 1 and no 3 are a single objects…

                   

                  Uwe

                  • 6. Re: Platziertes Snippet ungreifbar
                    Michael Rosenstein Level 1

                    I also made some tests with my ungrouped snippet:

                     

                    1) myObject = app.documents[0].place(myFile);

                     

                    myObject is undefined - mayve because the snippet is at the cursor and not placed yet.

                     

                    2) myObject = app.documents[0].pages[0].place(myFile);

                     

                    myObject is an Array.

                     

                    According to Jongware's CS3 Object Reference ;-)

                    page.place() has other arguments than document.place():

                    Array of any place (fileName: File[, placePoint: Array of Measurement Unit (Number or String)][, destinationLayer: Layer][, showingOptions: bool=false][, autoflowing: bool=false][, withProperties: Object])