I have resolved this. Basically the installation of InDesign CS3 on Vista doesn't register the COM interfaces in the registry. Once I registered all the interfaces everything is working.
Could you tell us how you did that ?
I am having the same issue here.
Did anyone manage to get this working? Which COM interfaces need to be registered, and how do you do this?
When something that works on XP fails in Vista, it's usually because of a file/folder permissions issue. When you go to Project>Add Reference in Visual C#, and then click the COM tab, are you able to see the Adobe InDesign CS3 type library? If not, click the Browse tab and locate the Resources for VisualBasic.tlb file (you might have to use Search to find it). Can you load this file? If not, try checking the permissions to the file.
This seems to make a lot of sense. It all seems to work now and I'm not sure why. I tried to re-register the InDesign exe and it may have been this which made it work. I have two copies of the tlb file now, one in my own c:\user\ directory, which on Vista gives me full rights. I think the problem is with permissions.
I have the same problem for a month now and it drives me nuts.
I cannot add a reference to resources for Visual Basic.tlb to VS 2003 the way you describe, at least not by Browse.
VS keeps indicating that it can't and that the file is either not accessible or is not a valid assembly or COM component.
I have full Administrative rights, allowed full access to the user directory and all its sub folders, made several copies of the tlb and tried to load them, run VS 2005 as Administrator, with no luck.
How do I "register all the COM interfaces" as Robert Bozetto describes in his post ?
How did you re-register Indesign.exe (I tried regsvr32 indesign.exe, says indesign.exe is loaded but entrypoint DllRegisterserver not found).
Still can't create reference to Resources for VB.tlb from VS2005.
Just managed to register the tlb at least so it seems; it appears that the Resources for VB.tlb file was damaged (maybe because i tried to register it earlier with regsvr32 or by upgrading InDesign to 5.0.2 ?). I could repair it from a recovery version (at last Vista did something for me) and could reference it by Browse.
But now I receive an error in VS2003 which says that the System_COM variable can't be converted to interfacetype InDesign.Application; Interface not supported.
What to do now ? How to register all COM interfaces ?
I'm not absolutely sure how I managed to get it to work. I opened a cmd window as adminstrtaor (type cmd in Start, right click cmd shortcut and pick Run as Administrator). In then browsed to InDesign.exe and tried to use regsvr32.exe, however exe has no entry point, so I tried running InDesign.exe directly from command prompt (some exe's self register). I think it was this bit which worked - i.e. InDesign running under administrator from command prompt appears to re-initialise and register COM interfaces.
By the way, the code above will not work, you need to use CreateObject and cast back (the second line may wrap in this message):
Type oType = Type.GetTypeFromProgID("InDesign.Application");
InDesign.Application app = (InDesign.Application) Activator.CreateInstance(oType);
Hm. The ExtendScript Toolkit that comes with CS3 has both code completion and intellisense, but it can be kind of slow. You have to have targeted InDesign from the pop-up menu at the upper-left of the ESTK editor window--otherwise, it's not connected to the DOM. Let me know if you've targeted InDesign and it's still not working for you.
InDesign scripting supports AppleScript, VBScript, and ExtendScript, and is loosly typed by design. The farther you go from those languages, and the more you attempt to employ strong typing, the more trouble you'll have.
I do have to do some investigatino with Vista, though--all I know right now is that connecting to the COM library works fine for me from C# Express on a Vista VMWare machine. I'll keep trying (as time permits--which it mostly doesn't) to get it to fail, but these installs take a long time!
Tried your suggestion on starting InDesign.exe from the command prompt; it makes the .tlb file refresh, but does not solve my problem.
when i try your code ported to VB.NET the result is still the same; .NET keeps sayubf the COM interface cannot be started with the indicated CLID.
Suggestions anyone (other than skipping the idea to do this in Vista)?
After looking at registry I found that COM interfaces it requests are indeed not registered.
When trying to register "Resources for Visual Basic.tlb" manually Vista gave "the module may not compatible..." error.
Fourtunately I found this great post by Jeff Klassen,
Go there and get the reg file to import the registry.
Err, in addition to my previous post, I did not do registration of tlb correctly. So instead of importing reg file you should be able to just run command line as Administrator and run this: regtlb.exe "c:\ProgramData\Adobe\InDesign\Version 5.0\Scripting Support\5.0\Resources for Visual Basic.tlb"
Thanks for your post Anna and hats off for Jeff Klassen; I finally can run my software to control InDesign on Vista now after using his .reg file.
Strange enough this error is still not solved by Adobe, at least not in the 5.0.3 update I just installed.....
re: "Strange enough this error is still not solved by Adobe, at least not in the 5.0.3 update I just installed....."
I'm sorry, why should Adobe fix a "problem" with an unsupported language? How can Adobe fix a problem that has to do with user permissions in Vista?
I bumped into this same problem and tried a few of the solutions above, but it did not work. I've then come up with the following amended procedure that does seem to work - no need to download anything (I don't like downloading 'wild' files of uncertain origin).
1) Start a Command line window as Administrator (I am using the 'classic' start menu, and I do: Click Start button -> Programs -> Accessories -> Command Prompt.
Right click the 'Command Prompt' entry. Select 'Run as administrator')
2) Delete Resources for Visual Basic.tlb. To do that I typed:
CD "%ALLUSERSPROFILE%\Adobe\InDesign\Version 5.0\Scripting Support\5.0"
REN "Resources for Visual Basic.tlb" "Resources for Visual Basic.tlb.old"
This moves the existing file out of the way without actually deleting it
3) Launch InDesign.exe - type:
"C:\Program Files\Adobe\Adobe InDesign CS3\InDesign.exe"
Let InDesign come up and stabilize itself. Then Exit it again
4) Verify a new tlb file has been created - type
A new file "Resources for Visual Basic.tlb" should be shown next to the old one
5) Exit out of the command line window - type
Now things should be working - at least, they did for me...
Just wanted to share my findings on how to resolve this issue.
I recently received this error when trying to run InDesign Server CS4. The server starts correctly, but I could not connect to it via my .NET service.
I received this error:
Unhandled Exception: System.Runtime.InteropServices.COMException (0x800401E4):
nvalid syntax (Exception from HRESULT: 0x800401E4 (MK_E_SYNTAX))
at System.Runtime.InteropServices.Marshal.MkParseDisplayName(IBindCtx pbc, S
ring szUserName, UInt32& pchEaten, IMoniker& ppmk)
at System.Runtime.InteropServices.Marshal.BindToMoniker(String monikerName)
To fix this issue, I found out that you must delete the directory mentioned above:
CD "%ALLUSERSPROFILE%\Adobe\InDesign\Version 5.0\Scripting Support\5.0"
Obviously, not this directory, but the equivalent server version directory.
If you are using multi instance, then delete does also.
This is the important step:
Make sure you run the InDesignServer.com with administrative rights (run as administrator).
This rebuilds the scripting file and all should work.