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++.
Thanks for ur reply,
i know and i also access indesign in C#, but i need to access a third party plug-in (In-Math Styles Plugin) for this they give a C/C++ Header Files(API's), and they tell try to access the third party plugin with the help of the header files,
for this, C# does not allow header files, so i will try to access this with VC++, but i am new to VC++, so i dont know how to add a COM to the project and access through that COM,
if u have idea, or please disscuss this with ur friends and then reply me
thanks and with regrds,
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.
PS. jongware: teh 4LL C4PS pwnz ur 133+ :-)
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
Thanks for ur reply, sorry for long time, because i have included in another project work
Now, i accessed the Indesign through VC++, with the help of your code as in above mail,
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.
so u knidly give me some scripting examples for Indesign throgh VC++
reply me ASAP
thanks and with regrds,
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?
i also dont know that the InMath plugin support the InDesign scripting, but the InMath Plugin works succesfully in InDesign, my work is to access the plugin through source code(programming)
re: "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?"
if there is change to access the plugin through Header files what are the ways to access that?,
I Think API means the header files, but i not sure
please explain the differences
>i also dont know that the InMath plugin support the InDesign scripting
The alternative way is, in effect, writing your
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.
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.
again i have some doubts, how to use the adobe in design SDK in our VC++ project.
i.e., if i use the header file in my project it will give an error
"fatal error C1083: Cannot open include file: 'VCPlugInHeaders.h': No such file or directory"
if i include the hole sdk header files in my project then again i get a error on the sdk header files,
but when i use sdk sample Writefishprice plugin project, they access the indesign SDK header files, but not included in the project folder, how they do this?
please reply ASAP
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
Then it give error 'InDesign ' : is not a class or namespace name