2 Replies Latest reply on Sep 23, 2008 11:13 AM by (Rod_Kiln)

    OLE-Programming Adobe Indesign(CS3):

    Level 1
      Need urgent help:

      This is what I came up with so far:
      I can LOAD INDESIGN and also LOAD a Document.
      See code below:

      procedure TForm1.Button1Click(Sender: TObject);
      var
      MyIndesign : OLEVariant;
      begin

      MyIndesign := CreateOleObject('Indesign.application.cs3');
      MyIndesign.Open('C:\TEST.indd');

      showmessage('');

      MyIndesign.Quit;
      MyIndesign := Unassigned;
      end;

      So far, so good! Indesign Starts OK, the indicated document shows also! But the big question remeins: HOW can I address the image frame on
      this document? Didn't anybody do this before?

      For example: The line
      ( MyIndesign.ActiveWindow.ActiveSpread.PageItems.Count )
      shows how many items there are on my page BUT how do I ACCESS this item?

      Does somebody know the exact line to go to the frame & place a picture into it?

      Thanks to all,
      Rod
        • 1. Re: OLE-Programming Adobe Indesign(CS3):
          Level 1
          Hi Rod,

          Have you taken a look at the InDesign CS3 Scripting Guide: VBScript? Or the associated scripts? (Both are available at the InDesign Scripting Home Page listed at the top of this forum.) Or at any of the VBScript samples that are installed with InDesign CS3? I'm pretty sure you can find what you need in one or more of those.

          But the quick answer to your question requires another question--how do you know which image you want to refer to? If you want to get at it by its file name, then it's best to approach it via the Document.Links collection. If you want to find it in a specific place in the layout, you'd get a reference to the page or spread (as you've already done) and then iterate through the page items on the page until you find the one that meets the criteria you're searching for. You might take a look at the SelectItems.vbs script to see the basics of how to do this.

          Thanks,

          Ole
          • 2. Re: OLE-Programming Adobe Indesign(CS3):
            Level 1
            Hi Ole,

            thank you so much for your reply. I started thinking that there was nobody out there at all.

            Yes, I have gone through several VBScript samples which is how I found out the code I stated in my original request. However, all the other listed lines in those examples produce error codes like:
            'This statement not supported... '. I have tried several options.

            There ought to be some sort of type library which I can not find.
            All the applications like Word etc. have there own way of addressing
            items when using the OLE-container.

            All I need is actually something to start with for one picture frame
            and one text frame underneath. One picture should be loaded from a file into the picture frame. At the this time, it would be enough if I could experiment with an item number. But any other method would be good as well.

            I must go on with the project and would be really grateful if
            there were some solutions.

            Thank you so much,
            Rod