Copy link to clipboard
Copied
Hi,
Not sure if this is the right place but...I'm trying to automate InDesign CS5 to create a proof of concept prior to purchasing a bunch of licences.
I've been using VBScript to test with but in production we'll use C++ and there's the problem.
I'm trying to use #import to import the TLB and build the interfaces for me so I can start coding. But I get LOADS of errors, such as:
1>d:\indesign scripting\cpp\createtest\x64\debug\resources for visual basic.tlh(80720) : error C2370: 'InDesign::idBeforePlace' : redefinition; different storage class
1> d:\indesign scripting\cpp\createtest\x64\debug\resources for visual basic.tlh(80718) : see declaration of 'InDesign::idBeforePlace'
1>d:\indesign scripting\cpp\createtest\x64\debug\resources for visual basic.tlh(80721) : error C2370: 'InDesign::idAfterPlace' : redefinition; different storage class
1> d:\indesign scripting\cpp\createtest\x64\debug\resources for visual basic.tlh(80719) : see declaration of 'InDesign::idAfterPlace'
1>d:\indesign scripting\cpp\createtest\x64\debug\resources for visual basic.tlh(80725) : error C2370: 'InDesign::idBeforePlace' : redefinition; different storage class
1> d:\indesign scripting\cpp\createtest\x64\debug\resources for visual basic.tlh(80718) : see declaration of 'InDesign::idBeforePlace'
Caused by code in the TLH such as:
const BSTR idBeforePlace = (wchar_t*) L"beforePlace";
const BSTR idAfterPlace = (wchar_t*) L"afterPlace";
const BSTR idBeforePlace = (wchar_t*) L"beforePlace";
const BSTR idAfterPlace = (wchar_t*) L"afterPlace";
const BSTR idBeforePrint = (wchar_t*) L"beforePrint";
const BSTR idAfterPrint = (wchar_t*) L"afterPrint";
const BSTR idAfterAttributeChanged = (wchar_t*) L"afterAttributeChanged";
const BSTR idBeforePlace = (wchar_t*) L"beforePlace";
const BSTR idAfterPlace = (wchar_t*) L"afterPlace";
const BSTR idBeforePlace = (wchar_t*) L"beforePlace";
const BSTR idAfterPlace = (wchar_t*) L"afterPlace";
const BSTR idBeforePlace = (wchar_t*) L"beforePlace";
const BSTR idAfterPlace = (wchar_t*) L"afterPlace";
This is using VS2008 and the latest InDesign CS5 downloaded from the side a day or two ago.
Any suggestions? Is there a better way? Any help would be greatly appreciated.
russ.
Copy link to clipboard
Copied
If your intention is to create a prototype anyway, continue to use VBScript rather than the more modern incarnations of VB. InDesign scripting was intentionally designed ignoring strong (object) typing. You might also consider ExtendScript, just because the community is much larger - next door in the scripting forum. That scripting forum would also be a better place to sort out your CS5 TLB problems - a minority over there prefers C#, the bigger VB and other languages - years ago I've even seen reports on Delphi.
There are also ways to produce "managed" / .Net code using C++, again working against the TLB. Apparently you try that with the mentioned errors as result. With that approach you'll be a very small minority, though. Some C# folks reported they had success by manually disassembling the TLB, clean up and rebuild it. Maybe an approach for you?
This forum is about developing plugins with C++ against the SDK - a separate, much richer set of C++ headers and binary libraries than exposed to scripting (what you see in the TLB). Again, you will not need the TLB. Getting started here will be a completely different experience, and you will most likely not be able to reuse most parts of your prototype code's architecture - anything beyond feeding the document object model.
Dirk
Copy link to clipboard
Copied
As I said; in production we'll use C++. The PoC is fine and as such works okay but of course the next step is actually building parts of the project, extending the test to include tools and other ideas...hence the need now to use C++.
I'll post the same in the scripting forum to see if anyone else has any ideas why the TLB is broken and what I can do about it.
Copy link to clipboard
Copied
Mention very prominently that you intend to program C++ against the Scripting / TLB API rather than against the SDK API of plugins, and that you are aware of the difference. Otherwise they'll bounce you back to here 😉
Dirk
Find more inspiration, events, and resources on the new Adobe Community
Explore Now