7 Replies Latest reply on Mar 16, 2012 4:33 AM by John Hawkinson

    Snippet idms thumbnails

    marius_9

      Hello everyone,

      I'm a really new user in InDesign scripting, and I'm looking for a solution to generate an image (.jpg file for instance) from a snippet (.idms or .idml file), in command line, in order to launch this command from a website page. I already look in InDesign docs but I didn't know where to start : InDesign script, Server, maybe a solution with Bridge...

      After that (maybe not right now), I wanted to be able to add parameters to this utility : a title, an image path..

      Thanks all for your help, or if you know an equivalent solution.

        • 1. Re: Snippet idms thumbnails
          Harbs. Level 6

          By default, InDesign saves a preview of the snippet in an idms file. You can extract that and save as an image file.

           

          You should look for the content inside the <xmpGImg:image> tag.

           

          Harbs

          1 person found this helpful
          • 2. Re: Snippet idms thumbnails
            marius_9 Level 1

            Thanks Harbs for the answer. It's a really good start.

             

            Now I would like to dynamically interact with this idms : change text, add an image,.. and so update this idms file to get new preview.

            Maybe some InDesign scripts can do that

            • 3. Re: Snippet idms thumbnails
              John Hawkinson Level 5

              Now I would like to dynamically interact with this idms : change text, add an image,.. and so update this idms file to get new preview.

              Maybe some InDesign scripts can do that

              Well, you have two choices.

              You can sit down with the IDML specification and determine how to manipulate the XML file directly.

              Or you can do it as you would do it in InDesign: Open a new document, place the IDMS file, edit the document, and export to IDMS.

              1 person found this helpful
              • 4. Re: Snippet idms thumbnails
                marius_9 Level 1

                That's exactly what I have done : create new document, place my IDMS file, load datas from easycatalog, and export to jpeg file.

                My script is fine, now I'm looking for the best way to call this .jsx from my PHP code and passing few arguments

                Thanks for your help !

                • 5. Re: Snippet idms thumbnails
                  John Hawkinson Level 5

                  My script is fine, now I'm looking for the best way to call this .jsx from my PHP code and passing few arguments

                  Uhoh.

                   

                  PHP? We need a lot more information! Is this running on a web server? Is the web server running InDesign? Or is it some other arrangement? What operating system?

                   

                  You now have two major problems, one technical and one political.

                   

                  The technical problem is how you call InDesign's Javascript from PHP. The answer is OS-specific, and probably involves AppleScript (or Scripting Bridge and AppleEvents) on a Mac, or VB (COM+/.NET, and more TLAs no doubt) under Windows.

                   

                  But the political problem is likely Insurmountable. InDesign's EULA prohibits automated scripting of the application from a web server. So if that's what you're trying to do, unless you have determined that the EULA does not apply to you, you have a problem.

                   

                  One solution to this is to purchase InDesign server, which can get you a EULA that permits this. This is in the teens of thousands of dollaris ($USD) though, I believe, which makes it impractical. (By "teens" I mean between USD$10,000 and USD$19,999, and I really don't remember the pricing.)

                  • 6. Re: Snippet idms thumbnails
                    marius_9 Level 1

                    Sorry for my lack of details !

                    I try to find a way to launch from a command line from a Unix Server.

                    First in InDesign on local on my mac, but after with InDesign Server (I have a licence, don't worry !)

                    So I'll try an AppleScript. Do you know a solution to pass arguments to my script with appleScript ?

                    • 7. Re: Snippet idms thumbnails
                      John Hawkinson Level 5

                      Well, the baseline example would be:

                       

                      osascript -e 'tell app "Adobe InDesign CS5" to do script "alert(33);" language javascript'

                       

                      to pass a JS expression, alert(33);, to InDesign. I believe you can also pass a file path, and there is a "with arguments" form (check the dictionary). Just watch your quoting.