6 Replies Latest reply on Mar 27, 2008 9:11 PM by dhishok

    [AS] Indesign CS - place image into existing frame.

      Hi All,

      Working on a script to do a rough assemble of content into an InDesign file. Need to know the syntax to reference an existing picture box - Ie. on a master page. I have a basic script which can place an image on a page, how do I specify the frame that it goes to? and how a picture boxes differentiated? by geometry? by tag?

      set imagetoplace to choose file with prompt "Select an image to place in Indesign"
      display dialog imagetoplace as string
      tell application "InDesign CS"
      tell document 1
      place imagetoplace on page 1
      -- Expect that there is something that needs to go after "page 1" to identify the target frame. What is the syntax for this? And what it there is more than one frame?
      end tell
      end tell

      I've been searching this site - but it looks like the more complicated scripting is done with Javascript. Is Javascript a better option for InDesign automation? Adobe also produces an Applescripting guide for InDesign, which is very useful as it has lots of sample scripting, this has chapters on text format but almost nothing on working with images.

      Thanks in Advance.

      Matt.

      Model: G4 933 1GB/60/SD
      AppleScript: 1.9.3
      Browser: Firefox 2.0.0.12
      Operating System: Mac OS X (10.3.9)
        • 1. Re: [AS] Indesign CS - place image into existing frame.
          sstanleyau Level 4
          You need to place it on a rectangle or other page item. So:<br /><br /> place imagetoplace on page item "Some label"<br /><br />will place it on a page item that has been labelled "Some label' using the<br />Script Label panel. You can also use forms like:<br /><br /> place imagetoplace on rectangle 1 of page 1<br /><br />which will place it on the frontmost rectangle.<br /><br />-- <br />Shane Stanley <sstanley@myriad-com.com.au>
          • 2. Re: [AS] Indesign CS - place image into existing frame.
            Level 1
            Hi Matt,

            The scripting object model is the same for all languages--there are just a few minor differences here and there, and changes in spacing to make the different languages happy. (What is "view preferences" in AppleScript is "viewPreferences" in JavaScript and "ViewPreferences" in VBScript, for example.)

            The main reason to use JavaScript instead of one of the platform languages is that it'll work on either platform. That's why I tend to post examples here in that language--but I like AppleScript and VBScript, too.

            Hope this helps!

            Thanks,

            Ole
            • 3. Re: [AS] Indesign CS - place image into existing frame.
              Level 1
              Thanks Shane,

              That's done the trick.

              Here's the updated script :

              tell application "Finder"
              -- Select source folder
              set srcfolder to choose folder with prompt "Select a folder of images to place in Indesign"

              -- Count the number of images to place
              set imageqty to count every item of folder srcfolder
              display dialog imageqty & " images to place" as string giving up after 2

              -- Create list of images to place
              set PicList to every item of folder srcfolder

              end tell

              set picboxnum to 1

              -- Indesign construction - assumes sufficient frames on page
              tell application "InDesign CS"
              activate
              tell document 1
              repeat with thisitem in PicList
              -- display dialog thisitem as string
              place thisitem as alias on rectangle picboxnum of page 1
              -- with properties {"centre content"} ?? can't get this working.
              select rectangle picboxnum

              -- Sub routine to get the image to centre - can't nut this out in the "place" command
              tell application "System Events"
              tell process "indesign CS"
              set frontmost to true
              keystroke "e" using shift down & command down
              end tell
              end tell

              -- Thanks Shane Stanley Adobe Forums
              set picboxnum to (picboxnum + 1)
              end repeat
              end tell
              end tell

              2 Further things I'm still working on:

              1. How do I release a frame from a master page to place a graphic into. Tried "activate rectangle 1" but to no avail.

              2. I opened the "Script Label" palette, but it's BLANK with no controls to access. Tried selecting the frame to tag but still no options. Is there a primer somewhere to get me going on the "script label" palette.

              Thanks again.

              Matt.
              • 4. Re: [AS] Indesign CS - place image into existing frame.
                sstanleyau Level 4
                On 24/3/08 5:19 PM, "Matt McGregor" <member@adobeforums.com> wrote:<br /><br />> --  with properties {"centre content"} ?? can't get this working.<br />Use: <br /><br /> fit rectangle picboxnum given center content<br /><br />> 1. How do I release a frame from a master page to place a graphic into. Tried<br />> "activate rectangle 1" but to no avail.<br /><br />Use the override command:<br /><br />  override rectangle 1 of master spread 1 destination page page 1<br /><br />> 2. I opened the "Script Label" palette, but it's BLANK with no controls to<br />> access. Tried selecting the frame to tag but still no options. Is there a<br />> primer somewhere to get me going on the "script label" palette.<br /><br />There are no options: select a frame, click in the panel, type a label, hit<br />enter (not return).<br /><br />-- <br />Shane Stanley <sstanley@myriad-com.com.au>
                • 5. Re: [AS] Indesign CS - place image into existing frame.
                  Level 1
                  Hi Shane,

                  Thanks again. All 3 solutions work great.

                  tell application "Finder"
                  -- Select source folder
                  set srcfolder to choose folder with prompt "Select a folder of images to place in Indesign"

                  -- Count the number of images to place
                  set imageqty to count every item of folder srcfolder
                  -- display dialog imageqty & " images to place" as string giving up after 2

                  -- Create list of images to place
                  set PicList to every item of folder srcfolder

                  end tell

                  -- Indesign construction - assumes sufficient frames on page
                  tell application "InDesign CS"
                  activate
                  tell document 1
                  set picboxnum to 1
                  repeat imageqty times
                  override rectangle picboxnum of master spread 1 destination page page 1
                  -- Thanks Shane Stanley Adobe Forums - for "override rectangle"
                  set picboxnum to (picboxnum + 1)
                  end repeat

                  set picboxnum to 1
                  repeat with thisitem in PicList
                  -- display dialog thisitem as string
                  -- override rectangle picboxnum of master spread 1 destination page page 1

                  place thisitem as alias on rectangle picboxnum of page 1
                  -- Thanks Shane Stanley Adobe Forums - for "on rectangle"

                  fit rectangle picboxnum given center content
                  -- Thanks Shane Stanley Adobe Forums - for "given center content"

                  set picboxnum to (picboxnum + 1)
                  end repeat
                  end tell
                  end tell

                  Warm Regards,

                  Matt.
                  • 6. Re: [AS] Indesign CS - place image into existing frame.
                    dhishok Level 1
                    Hi all,

                    We have two different folders named (Job Volume & Completed Art) in our server. Our InDesign file arts are completely linked with 'Completed Art' folder only. But some of the arts are modified in the Job Volume folder as well as in the Completed Art folder also. Here the Problem is we want check each every images of these two folders whether which one is updated art. After finding the updated art from this folders, then we have placing it into "Completed Art" folder. Finally we update the links in the InDesign file. This process is too hectic for us. If anyone provide the script for this issue.

                    Please revert if you have not clear.

                    Thanks & Regards
                    Thiyagu