Skip navigation
Currently Being Moderated

how to access indesign cs3 document through VC++

May 4, 2008 11:15 PM

Hello

i am new to VC++, i need to communiacte Indesign CS3 through VC++, for this what can i do? inorder to access indesign docuemnts,

i also need to access a Third party API for CS3 through VC++, for the two puproses, i dont have any idea, so

kindly help me

with regards,
ram
 
Replies
  • Currently Being Moderated
    May 5, 2008 9:00 AM   in reply to (ramanathan.ct)
    Hi ram

    InDesign exposes all its methods through a COM object. Don't know how to use it in VC++, but in C# I simply add a reference to the COM object (Adobe InDesign CS3 Type Library), whereafter I can instantiate (start up) InDesign, open documents and manipulate them in any way I want.

    Others in this forum uses VB to access the COM object, so it should also be possible to use VC++.

    BR
    Bo
     
    |
    Mark as:
  • Currently Being Moderated
    May 5, 2008 11:06 AM   in reply to (ramanathan.ct)
    Hi ram,

    You probably want to ask this question in the InDesign SDK forum--that's where the third-party API developers hang out.

    You can work with the InDesign scripting object model using C++, but I think you're probably asking about developing InDesign plug-ins using the C++ SDK.

    Thanks,

    Ole
     
    |
    Mark as:
  • Currently Being Moderated
    May 6, 2008 7:26 AM   in reply to (ramanathan.ct)
    My friends think you should ask about COM objects in a VC group, not a typesetters' hangout.

    They also appreciate the odd capital and think l33tsp33k is so 2001.
     
    |
    Mark as:
  • Currently Being Moderated
    May 6, 2008 10:10 PM   in reply to (ramanathan.ct)
    Hi ram,

    I don't know if In-Math supports InDesign scripting, but you have not yet realized that the C++ API and the COM objects exposed to scripting (i.e., VBScript, C#) are TWO FUNDAMENTALLY DIFFERENT THINGS. Which do you want to use? If they gave you C++ header files, you want the SDK forum. That's a different forum. This is the InDesign scripting forum.

    Thanks,

    Ole

    PS. jongware: teh 4LL C4PS pwnz ur 133+ :-)
     
    |
    Mark as:
  • Currently Being Moderated
    May 13, 2008 11:06 AM   in reply to (ramanathan.ct)
    Hi ram<br /><br />As Olav has pointed out, you need to decide whether to use COM or SDK.<br /><br />SDK is hard core - and I really mean HARD CORE. I consider myself to be a reasonably good VC++ programmer, but when I tried to develop an InDesign plug-in using SDK and VC++ I was completely lost.<br /><br />However it is possible to use VC++ to control InDesign via the COM object.<br /><br />Here is what you should do:<br /><br />1) Make a new VC++ project (MFC, MFC Application)<br />2) In Wizard dialog select Dialog Based and leave everything else unchanged (simply press Next)<br />3) You now have a simple empty dialog with 2 buttons<br />4) Double-click the OK button<br />5) Insert the following code (before OnOK()):<br /><br />// COM support required for this<br />//  Call CoInitialize() to initialize the COM library on the current thread<br />if(::CoInitialize(NULL) != S_OK) return;<br /><br />// Create instance of InDesign Application<br />InDesign::_ApplicationPtr app;<br />// Use the appropriate version here<br />//  This string will be used to search the registry for the application<br />//  associated with it and the same is invoked. <br />//  If you have different builds of the same version and you want to work<br />//  with a specific build, call CreateProcess() for that build and then<br />//  call CreateInstance() so that the currently running instance is returned.<br />app.CreateInstance(L"InDesign.Application.CS3");<br /><br />// Open existing document<br />InDesign::DocumentPtr doc = app->Open("C:\\InDesign\\myDocument.indd", true);<br />InDesign::PagePtr page = doc->Pages->FirstItem();<br />InDesign::TextFramePtr textFrame = doc->TextFrames->FirstItem();<br />textFrame->Contents = "Hello world";<br /><br />6) Go to the start of the file<br />7) Insert the following code before // CAboutDlg dialog used for App About<br /><br />// Required for calling COM initialization methods<br />#include <objbase.h><br /><br />// Import InDesign's Type Library<br />#import "C:\Documents and Settings\All Users\Application Data\Adobe\InDesign\Version 5.0\Scripting Support\5.0\Resources for Visual Basic.tlb"<br /><br />8} Build and run the project (F5). When you press OK, InDesign should launch, open your document, find the first page, find the first TextFrame and replace the text (contents) with "Hello world"<br /><br />How to get in contact with your third-party API is a completely different ball game (not in the scope of this forum), but at least you now have a VC++ project with header files etc.<br /><br />If your third-party API is indeed an InDesign plug-in, I totally agree with Olav that you have to direct your questions to the SDK forum.<br /><br />Best regards,<br />Bo
     
    |
    Mark as:
  • Currently Being Moderated
    Jun 7, 2008 12:57 PM   in reply to (ramanathan.ct)
    Hi ram,

    re: "but i need to know how to access the textframe->content with font and colours, so i will get some ideas of accessing the InMath Third Party Plug-in."

    Does InMath support InDesign scripting? I don't know. If it doesn't, learning about the native InDesign scripting objects/properties/methods will not do you any good. If they gave you C++ header files, chances are good that they do not support scripting, but do provide a C++ API. These are two very different things. Do you understand the difference?

    Thanks,

    Ole
     
    |
    Mark as:
  • Currently Being Moderated
    Jun 9, 2008 1:50 AM   in reply to (ramanathan.ct)
    >i also dont know that the InMath plugin support the InDesign scripting

    An easy way to check is if you can access it through JavaScript. If so, you can do the same in C++ as you can do in JS -- that is, using the objects, properties, and methods they provide to use the plugin.

    The alternative way is, in effect, writing your
    i own
    plugin. That is definitely NOT for the faint hearted, let alone for the casual explorer you appear.
    In that case you need the original C++ header files for the plugin, just as Adobe provided the original C++ header files to all InDesign components -- scriptable and other.

    >please explain the differences

    I think Ole's point was, if you need the differences explained to you, you're already in more trouble than you can handle.
     
    |
    Mark as:
  • Currently Being Moderated
    Jun 9, 2008 8:35 AM   in reply to (ramanathan.ct)
    Hi Ram,

    If InMath does not support InDesign scripting, then you would not use COM--you'd create a plug-in, DLL, or separate program to address the InMath API (just as an InDesign plug-in works with InDesign's API).

    My main point is: I don't know anything about InMath, and their web site doesn't really tell me much about the features of the plug-in, let alone anything about its support for scripting. Without that information, I can only make guesses.

    This means that the questions you're asking are best answered by the InMath developer. C++ header files alone will not give you what you need to know.

    Looking at the InMath site, however, I note that they say that they use native InDesign objects. They don't offer a direct download of a demo, but you could try sending me a file with an InMath equation in it (my email is under my user name; send me a message before you send a file). If they don't create an InMath object of some sort, we might be able to get at it. If this is the case, you won't even need to use C++ (you'll be able to use JavaScript or another of the supported languages).

    Thanks,

    Ole
     
    |
    Mark as:
  • Currently Being Moderated
    Jun 18, 2008 10:12 PM   in reply to (ramanathan.ct)
    Hi ram,

    Have you tried asking this in the InDesign SDK forum?

    Thanks,

    Ole
     
    |
    Mark as:
  • Currently Being Moderated
    Apr 14, 2009 11:34 PM   in reply to (ramanathan.ct)

    Hi,

     

    Can anyone please help me to access InMath styles in InDesign SDK using VC++ Programming.

     

    Thanks

    Saravana

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 14, 2009 11:36 PM   in reply to (ramanathan.ct)

    Hi,

     

    Can anyone please help me to access InMath styles in InDesign SDK using VC++ Programming.

     

    Thanks

    Saravana

     
    |
    Mark as:
  • Currently Being Moderated
    May 14, 2012 10:58 PM   in reply to (Bo_Peters)

    Hi Bo_Peters

     

    I want to ask you that How create Indesign application using vc++ ?

     

    I am able to develop application in C# using COM and generate Interop.Indesign.dll using InDesign

     

    Using This code i am sucessfully create Indesign instance

    Type type = Type.GetTypeFromProgID("InDesign.Application");

    InDesign._Application application = (InDesign._Application)Activator.CreateInstance(type);

     

    I am not understand how use COM with vc++ or there is another method to create Indesign instance using vc++.

    If i use the steps that You told

     

    However it is possible to use VC++ to control InDesign via the COM object.

    Here is what you should do

    1) Make a new VC++ project (MFC, MFC Application

    2) In Wizard dialog select Dialog Based and leave everything else unchanged (simply press Next

    3) You now have a simple empty dialog with 2 buttons

    4) Double-click the OK button

    5) Insert the following code (before OnOK

    // COM support required for this

    //  Call CoInitialize() to initialize the COM library on the current thread

     

    if(::CoInitialize(NULL) != S_OK) return

     

    // Create instance of InDesign Application

     

    InDesign::_ApplicationPtr app

     

     

     

    Then it give error 'InDesign ' : is not a class or namespace name

     

    Thanks

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)