7 Replies Latest reply on Nov 8, 2018 12:09 AM by DBLjan

    Bound to use placegun, but how to maintain image attributes?

    DBLjan Level 3

      Hellø folks,

       

      were having this problem: We use a plugin, which fetches assets from a Dam and makes use of the placegun now by default. Thats very handy for multiple images. But they made it worse in the first place: Instead of rebuilding InD behaviour with their Plug, they completely now ignore, if a grahpic-container is selected and if its got any image inside.

       

      Resulting in every asset at the placegun, but now youre unable to exchange pictures in containers and maintain image-altering attributes.

       

      So, I have stuff hanging at my placegun, every time now. Am I somehow able to teach/script InDesign, to let me drop an image onto a used image-container and exchangeing the image but maintaining the attributes? Becuase I found out it makes a different, if the container is selected upon place or is used afterwards by the placegun

        • 1. Re: Bound to use placegun, but how to maintain image attributes?
          Manan Joshi Level 4

          If we talk about fitting options, i see that the frame fitting options applied on the container does hold its value even after replacing the image within the container. The tricky part is that if content is fitted using options other than the one applied on the frame i.e using the options within the context menu obtained on right clicking the frame like for ex: Centre Content. In this case i don't see any property being set on the frame. I doubt this could be done just by using scripting interface.

           

          However if we have a C++ plugin, we could put some observers to look for fitting being done and then add some labels onto the frame with the fitting value which can then be used to reapply the fitting when the image is replaced.

           

          It would be interesting to know the view of other members on this problem.

           

          -Manan

          • 2. Re: Bound to use placegun, but how to maintain image attributes?
            Pickory Level 3

            An idea.

             

            if there was a before place and after place event you could recored the settings on the before, then re-apply them on the after.

             

            These look interesting.

             

            Class

            PropertyTypeAccessDescription
            AFTER_PLACEstringreadonlyDispatched after a Graphic is placed. This event bubbles. This event is not cancelable. (default: afterPlace)
            BEFORE_PLACEstringreadonly

            Dispatched before a Graphic is placed. This event bubbles. This event is cancelable. (default: beforePlace)

            • 3. Re: Bound to use placegun, but how to maintain image attributes?
              Manan Joshi Level 4

              Hi Pickory,

               

              This could work if these events are raised even when the fitting options are changed i.e. not placing and also not changing the frame fitting options but just fitting the image already within the rectangle, that needs to be tested.

               

              -Manan

              • 4. Re: Bound to use placegun, but how to maintain image attributes?
                DBLjan Level 3

                Let me stop you right here guys:

                There are no fitting options involved. Just placed images, who got e.g. mirrored or inner-x = -0,235 or scaled.
                Look at picture below.

                 

                But I stumbled upon InDesign not blocked by anything/fully controlable, having an image hanging at my placegun.

                So I guess I can forget about events and just fire a script by hand if needed. That makes it a bit easier, also the placegun always holds just one image. What I cant do is to select any object, while something is hanging at the placegun, but a pre-selected image-frame stays selected. A script must take the data from the placegun, and push it in the pre-selected container, keeping the image-attributes.

                Is this something that can be done?

                Bildschirmfoto 2018-11-07 um 09.28.12.png

                • 5. Re: Bound to use placegun, but how to maintain image attributes?
                  Laubender Adobe Community Professional & MVP

                  …What I cant do is to select any object, while something is hanging at the placegun…

                  Hi Jan,

                  usually you can switch temporarily to the Selection Tool using the Cmd key ( Mac OS X ) when the Placegun is loaded.

                   

                  Regards,
                  Uwe

                  • 6. Re: Bound to use placegun, but how to maintain image attributes?
                    Manan Joshi Level 4

                    In that case you would need to copy over the property values from the original image on to the new image. Something like the following should work, i am copying over the vertical and horizontal scaling in this example

                     

                    var vScale = app.selection[0].images[0].verticalScale
                    var hScale = app.selection[0].images[0].horizontalScale
                    var fPath = app.activeDocument.placeGuns.rectangles[0].graphics[0].itemLink.filePath   //Get the filePath of the first item loaded in the placegun
                    app.selection[0].place(fPath)
                    app.selection[0].images[0].verticalScale = vScale
                    app.selection[0].images[0].horizontalScale = hScale
                    

                     

                    Run the above code with a selected rectangle with an image inside it and an image loaded on the placegun. Let us know if this helps or we are still off direction from what you want.

                     

                    -Manan

                    • 7. Re: Bound to use placegun, but how to maintain image attributes?
                      DBLjan Level 3

                      Thank you Manan Joshi for your time: I guess thats it, works like a charm!

                      …oh wait! Our Dam uses vault links, which again cant be processed without the interaction of the dam-plugin, which lacks this feature in the first place. All work for the trash, damn DAM. Not the first thing, Canto Cumulus messes up.

                       

                      And also thanks to UweLaubender, didnt knew that placgun/selection-tool trick


                      Heres alert(fPath):

                      Bildschirmfoto 2018-11-08 um 09.00.36.png