Automating InDesign from C++/MFC

Hi, I would like to be able to control InDesign via COM (aka Scripting Interface in Adobe InDesign parlance).
I've done this quite a few times for other apps including Acrobat Reader.
Normally it's possible to create an MFC C++ class from the TLB file.
For InDesign the only TLB/TypeLib file which I can find is "Resources for Visual Basic.tlb" buried deep in the Documents and settings folder. Seems to be rebuilt every time InDesign is run to take account of COM interface to plugins. All very well but the typelib Wizard in Visual C++ IDE doesn't read the file let alone generate the classes.
I've managed to do a 'half baked' test using
#import "Resources for Visual Basic.tlb"
that works but it's not as clear and certainly not as easy to see my way around.
Specifically I'm trying to control printing using print presets via COM.
I see it's possible from the VB examples.
Is there a core TLB in InDesign somewhere that I could use to generate the MFC classes?
Has someone done this before (in C++ of course)?
Does anyone have any experience or examples?
Many thanks
Caerwyn Pearce

I don't know how to generate MFC classes of InDesign.
But I am sure you can control InDesign with a "smart" pointer style.
(I don't know what is called this "smart" way.)
// import Type Library
#import "Resources for Visual Basic.tlb"
int findPreset( InDesign::_ApplicationPtr& app, const char* presetName, PrinterPresetPtr& preset)
int rt=-1;
PrinterPresetsPtr pres = app->PrinterPresets;
for(long m=1;m<=pres->GetCount();m++){
PrinterPresetPtr p = pres->Item[m];
if(p->Name == _bstr_t(presetName) ){
preset = p;
rt=0;
break;
return rt;
// inddPath : path of a InDesign document
// printSet : name of print set
void printOut( const char* inddPath, const char* printSet )
do{
InDesign::_ApplicationPtr app;
app.CreateInstance( L"InDesign.Application.CS2_J" ); //Japanese version
InDesign::DocumentPtr doc;
doc = app->Open( _bstr_t(inddPath), VARIANT_TRUE/*show*/ );
//fint Preset
PrinterPresetPtr preset;
if(findPreset(app,preset)!=0){
break;
_variant_t showDialog( true ); // show print dialog?
_variant_t showGrid( false ); // show grid? only Japanese version???
doc->PrintOut( showDialog, preset.GetInterfacePtr() , showGrid );
}while(0);
Hope this helps.
-Satoru

Similar Messages

  • Automating indesign

    Hi,
    I am new to Indesign scripting. I have developed a tool using VB.NET for automating word, for exporting text to a Word document and changing styles in it.
    Similarily, I want to export data to an Indesign Document.
    I want to know, what are the requirements/downloads (sdks/APIs etc.) required to develop a tool for automating Indesign?
    Thank you,
    Surya.

    I don't know how to generate MFC classes of InDesign.
    But I am sure you can control InDesign with a "smart" pointer style.
    (I don't know what is called this "smart" way.)
    // import Type Library
    #import "Resources for Visual Basic.tlb"
    int findPreset( InDesign::_ApplicationPtr& app, const char* presetName, PrinterPresetPtr& preset)
    int rt=-1;
    PrinterPresetsPtr pres = app->PrinterPresets;
    for(long m=1;m<=pres->GetCount();m++){
    PrinterPresetPtr p = pres->Item[m];
    if(p->Name == _bstr_t(presetName) ){
    preset = p;
    rt=0;
    break;
    return rt;
    // inddPath : path of a InDesign document
    // printSet : name of print set
    void printOut( const char* inddPath, const char* printSet )
    do{
    InDesign::_ApplicationPtr app;
    app.CreateInstance( L"InDesign.Application.CS2_J" ); //Japanese version
    InDesign::DocumentPtr doc;
    doc = app->Open( _bstr_t(inddPath), VARIANT_TRUE/*show*/ );
    //fint Preset
    PrinterPresetPtr preset;
    if(findPreset(app,preset)!=0){
    break;
    _variant_t showDialog( true ); // show print dialog?
    _variant_t showGrid( false ); // show grid? only Japanese version???
    doc->PrintOut( showDialog, preset.GetInterfacePtr() , showGrid );
    }while(0);
    Hope this helps.
    -Satoru

  • Is is possible to open indesign from a script?

    Is there any way to open indesign from within a script, or does the application already need to be running before a script can access it?
    Thanks in advance.
    Jude Fisher
    http://www.jcfx.eu

    In Applescript, when you compile the code, the app must be running. If it's not, then it will start.
    When you run the script, InD doesn't have to be started first. You could have some Finder actions happen, then InD starts at the needed time when it's actions occur. You can have an if/then statement that only requests InD to do an action only if other circumstances are met. You do not even need to tell application InD to launch, just the first tell app statement will do it.
    I do not know how things work in Javasc or VB.

  • Problems installing Illustrator and Indesign from CS3 suite

    I am trying to install Illustrator and Indesign from CS3 suite.  Previously I had been running a trial version on my Mac, and now am trying to install the suite from the original install discs.  I have gone through the process of uninstalling all of the Adobe programs and then reinstalling.  When the install disc loads up and I get to the point where it lists the programs to install, in the top box Illustrator and Indesign are listed as already being installed and have no option to install them.  When I search my computer there are no Illustrator or Indesign applications.  I am able to reinstall the rest of the suite and it seems to work fine but can't seem to figure out what step I'm missing as far as reinstalling Illustrator and Indesign are concerned. 

    I haven't tried doing it on Vista but I would recommend looking for 
    Adobe clean up programs.  The problem I had was that the computer had 
    a trial version and then I tried to install the full version and it 
    wouldn't let me install illustrator because there were some random 
    illustrator files that conflicted with the installation process.  I 
    ran clean up program and it removed all adobe files.  Then I 
    reinstalled photoshop.  Before you start running clean up programs 
    make sure you back everything up.  Good luck

  • I keep getting error message: unable to extract to temp directory when downloading InDesign from Creative Cloud

    I have Windows 7 32-bit Am trying to download InDesign from Creative Cloud desktop version and I keep getting the error message "Installation failed, Unable to extract to temp directory. Please contact customer support. (EX11)
    have tried going into temp files and moving Indesign file to desktop, but still failing

    Creative Cloud Error Codes (WIP) | Mylenium's Error Code Database
    Mylenium

  • [CS3 VB] Launching/activating InDesign from third program

    I need to activate (and if it is not running) start InDesign from another program - on Windows. Then InDesign should load some file. On the Mac I would call an AppleScript. I thought it should be possible with VB but I am not able to make it work. I tried this. (After this I would call JS to do the real work.)
    Set myInDesign = CreateObject("InDesign.Application.CS3")
    myInDesign.Activate
    What is the correct approach?
    Thank you,
    Ralf

    Hi Ralf
    Sorry that I was not more specific.
    I use Microsoft Visual Studio 2005 or 2008 to control InDesign.
    Visual Studio contains C++, C# and Visual Basic and all 3 languages can be used to gain full control over InDesign.
    I do not use scripts (although it is also possible to send a script to InDesign and execute it).
    I communicate directly with InDesign from my code.
    The code I use look a lot like scripting but there are slight differences in syntax.
    In general the following applies:
    Visual Basic code looks like VBScript
    C++ code looks like JavaScript
    C# code looks like JavaScript
    Using any of the 3 languages gives me the advantage, that I can single step on line at a time, and inspect what happens in InDesign.
    So to answer your question about the COM reference: Adding a reference to the InDesign COM object is a Visual Studio thing, so it only makes sense when you use this application.
    Best regards,
    Bo

  • How to get indesign from iMac to mac powerbook which does not have cd slot?

    how to get indesign from iMac to mac powerbook which does not have cd slot?

    That will not work!
    You cannot copy or migrate Adobe applications from computer to computer. There are a whole host of files in different locations which have to be installed, and copying will not do it.
    In fact, you'll now have to use the Adobe Cleaner tool to remove the mess you created. You can get to it here:
    Use the CC Cleaner Tool to solve installation ... - Adobe

  • Automated Message from Oracle Files

    Good Morning:
    When I set a new user account in Collaboration Suite, Oracle files generated a email notification like:
    "(Automated message from Oracle Files)
    An account has been created for you on Oracle Files
    (http://middleserver:7779/files/app) with the following
    User ID: user01
    In order to enable Protocol Access in Oracle Files you must go to
    http://middleserver:7779/files/app/ProtocolAccess and
    enter your Single Sign-On Password.
    Thank you for using Oracle Files. "
    But I need to change this message because the port setted is 7778 instead of 7779.
    Where I can change this default port for generate the correct notification?
    Thanks a lot for your help.

    Hello,
    I was wondering if we had the ability to handle this via the adapter?
    Possible, but you need to develop adapter module for this.
    It looks like a prologxmlepilog, but in your case, they are the ones sending. Where is the XML payload in the structure that you provided?
    You can re-escape the characters using java mapping. For example, find %3C and replace with < . Here is the complete list of URL escape characters http://www.december.com/html/spec/esccodes.html
    Hope this helps,
    Mark

  • How do I change the units in InDesign from p0 to mm?

    How do I change the units in InDesign from p0 to mm?

    And you can do the same for existing documents, or just right-click a ruler and change the units at any time (even using different units on each ruler if you like).

  • After automated update from Firefox 4 beta to RC I lost my profile

    After this morning automated update from Firefox 4 beta to the RC the browser created a new profile without importing the existing one .
    So, please help me to recover my data.

    ''it looks like the new version creates the default profile in C:\Windows\System32\config\systemprofile\AppData\Roaming\Mozilla\Firefox\Profiles\ I've copied the files from the older location (C:\Users\My _user\Roaming\Mozilla\Firefox\Profiles\) and the problem is solved.''
    ''if this is the intended behaviour, it sucks!''
    This is not normal behavior. The default Firefox profile folder should still be located here, on Windows Vista: <br>
    C:\Users\< user name>\AppData\Roaming\Mozilla\Firefox\Profiles\<profile folder>.
    <br>ref: http://kb.mozillazine.org/Profile_folder_-_Firefox#Windows
    Restart the computer and make sure you are logged into Windows as the correct user, by entering '''%USERPROFILE%''' into the Windows Start Menu "Start Search" box. Once you are sure you are logged in as the correct user, try starting Firefox again and see if you are using the old Firefox profile folder (go to Firefox -> Help -> Troubleshooting Information -> Open Containing Folder")
    You can also create a new Firefox profile with a unique name - see [[Managing profiles]] - then find the new profile folder and use the instructions here to copy over your data:
    [[Recovering important data from an old profile]] (It's better to only copy selected data and reinstall your needed extensions).
    A [http://www.google.com/search?q=%22%2FSystem32%2Fconfig%2Fsystemprofile%2FAppData%2FRoaming%2FMozilla%2F%22 google search on '''''"\System32\config\systemprofile\AppData\Roaming\Mozilla\"'''''] brought up a bunch of malware forum topics so you might want to check for malware - see http://kb.mozillazine.org/Standard_diagnostic_-_Firefox#Check_for_malware

  • How to stop Indesign from reverting to picas

    No matter how many times I set up a workspace (which sometimes it erases) I can not stop Indesign from defaulting to picas. It is the most annoying and ridiculously simple thing that having a workspace should solve. Yes, my workspace was set up correctly. This is a problem that goes way back to like CS3.
    How do I get it to stop. Ultimately, I don't want to even have the option for picas.
    kym

    Thanks! I just changed that. Now I will see how long it holds because over the course of time my workspaces disappeared, as well as my preference settings. I catch it mostly with typographer's quote marks. They convert to inch marks and then I have to start all over.
    Thanks so much, I will add another reply if it holds up.
    -kym

  • I downloaded InDesign from the CC and it isn't in English.

    Can someone please help me download InDesign from the Creative Cloud in English? This is nutty.
    Thanks.

    Change the language setting in the CC app prefs accordingly and reinstall
    Mylenium

  • Can I upgrade to CS6 InDesign from CS5?

    Trying to upgrade/download to CS6 InDesign from CS5 (CS5 v7)....

    Not sure if I can reply back here, but here goes.When I went to the link all was well. Then I went to the side link button - buy - it takes you to Adobe Store - Middle East and North Africa - which is only letting me purchase the full version.  I just finally was able to contact support via the phone and was helped thru this all. There was apparently some odd linking with the Adobe stores.  Thanks,Zoedog03

  • I still have my serial number but no software can I download my version of InDesign from your servers.

    I still have my serial number but no software can I download my version of InDesign from your servers.

    You can find links to the installers at the bottom of this page: Download and Installation Help

  • Automated messages from Apple in a language I do not speak

    Hi Everyone!
    For two weeks now everytime I connect to iCloud from any of my iOS devices, I get an automated message from Apple saying that I connected to iCloud using that specific device. The problem is that the message comes in French! Who can help me have Apple use English to communicate with me again????
    All my settings in my devices and iCloud have the language set for English.
    Thanks a lot!
    The message is as follows:
    Cher(ère) User,
    Votre identifiant Apple ([email protected]) a été utilisé pour ouvrir une session iCloud et iMessage à partir d’un iPhone 4S appelé « User´s iPhone ».
    Si vous n’avez pas récemment configuré un iPhone avec votre identifiant Apple, il serait plus sûr de changer le mot de passe de votre identifiant Apple.

    Same here. Except I am English and am in Spain and everything comes in Spanish. Just because I am in a country for a while does not mean I speak that language well enough to read all the details...
    APPLE PLEASE DON'T ASSUME THINGS THAT ARE NOT CORRECT!

Maybe you are looking for