7 Replies Latest reply on Sep 2, 2015 4:40 AM by Andreas Jansson

    JavaScript doScript commands fail to initiate VBScript


      I have a JavaScript that runs a VBScript to do some SendKeys statements (to load a Keyboard Set).  This script worked fine in CS4...but fails in CS5.5.


      The ExtendScript debugger reports:  "Unable to load Adobe InDesign CS5.5 Type Library (Version 1.0)."


      That lead me to this KnowledgeBase article (kb408389):  http://helpx.adobe.com/legacy/kb/javascript-doscript-commands-fail-initiate.html.


      I tried the fix mentioned in the KDB article (as written and with changes to reflect the different CS version as well as the actual path to the .tlb file on my system) and this has not helped.




      Thanks much!



        • 1. Re: JavaScript doScript commands fail to initiate VBScript
          Velprakash Level 1

          I'm also having the same Issue. Can anyone fix it!!!!!!!!! I'm using CS5.


          Thanks and Regards,


          • 2. Re: JavaScript doScript commands fail to initiate VBScript

            I'm having the same problem with CC, except that I don't know how to reflect the different version (CC instead of CS4) nor do I know where is the .tlb file on my system.

            Can anyone help me here please?

            • 3. Re: JavaScript doScript commands fail to initiate VBScript
              Luis Fernando Brito

              From the list of available references, select Adobe InDesign CS5 Type Library, and click OK. If the library

              does not appear in the list of available references, click Browse and locate and select the file Resources

              for Visual Basic.tlb, which is usually inside C:\Documents and Settings\<username>\Application

              Data\Adobe\InDesign\Version 7.0\Scripting Support\ (where <username> is your user name).

              If necessary, search for the file. Once you locate the file, click Open to add the reference to your project




              Ensure that you have the tlb file in place if you want exploar the file to see if this recomento corrupted the following software:


              • 4. Re: JavaScript doScript commands fail to initiate VBScript
                Nadav Level 1

                Thanks for the help.

                Unfortunately , this isn't entirely helpfull.

                I need to know which key to look for in the registry.

                The registry key in the article refers to C4.

                Also, I don't understand what you mean by "list of availabe references".

                Finally, I'm talking about CC in Win7 and not CS5 on winXP

                However, don't worry. Your answer did one really good thing. It gave me motivation to look for it by myself.

                I located the tlb file in "C:\ProgramData\Adobe\InDesign\Version 9.0-ME\en_US\Scripting Support\9.0\Resources for Visual Basic.tlb" using explorer search.

                Then, I looked for "Resources for Visual Basic.tlb" in the registry and found it in three different keys where they look for it in the hebrew version in here "C:\ProgramData\Adobe\InDesign\Version 9.0-ME\en_IL\Scripting Support\9.0\Resources for Visual Basic.tlb".

                (notice en_IL instead of en_US).

                So, instead of changing all three registry keys, I just copied the file to its appropriate location. Now it works just fine.



                Thank you for your help

                • 5. Re: JavaScript doScript commands fail to initiate VBScript
                  Luis Fernando Brito Level 1

                  @ AaronKuehn - It's possible to force the execution of the script for a dertimnada version of indesign is so add the following line at the top.

                  "app.scriptPreferences.version = 6"

                  6 is forcing CS4

                  • 6. Re: JavaScript doScript commands fail to initiate VBScript
                    Nadav Level 1

                    Thanks, good to know.

                    Though I don't like the idea of reducing the script to CS4 just because I don't know how to do it in CC.

                    Anyway, as I said before, I did solve it for CC as well.

                    • 7. Re: JavaScript doScript commands fail to initiate VBScript
                      Andreas Jansson Level 2



                      I just had a silimar case.


                      The user had just got a new computer with Windows 8.1, with the same InDesign version installed as on his old one (InDesign CS5).


                      When running our javascript (i.e. "extendscript") that use VBScript to get the user name in Windows and an applescript to get the user from OSX, he got this error on the new computer:


                      Javascript Error!

                      Error Number: 104705

                      Error String: Unable to load Adobe InDesign CS5 Type Library (Version 1.0).


                      The script code line that raised this error was the following:

                      gUserName = app.doScript(getUserCodeStringVB, ScriptLanguage.visualBasic);


                      The solution was to start InDesign CS5 as Administrator (right click the shortcut to InDesign in the start menu and select "Run as administrator"). Obviously that made the keys go to the right places in the registry. Now it works when the user runs InDesign as himself as well.


                      There are similar errors with Photoshop installations, and I had read that starting Photoshop as Administrator (once) might help. That's why I asked the user to try this. And it worked!


                      Perhaps this can be helpful for other people with the same error.


                      // Andreas