12 Replies Latest reply on Sep 28, 2009 11:19 AM by Olav Martin Kvern

    VBScript editor with Intellisense/Code Hinting support for Adobe App

    Matus Grinvalsky

      I am looking for some tool to write my InDesign VBScript files in. I would really like to know if there is any which support Intellisense/Code hinting for Adobe programs (InDesign especialy). Do you have anything to recommend?

       

      I am quite good at hacking my computer, so no registry change etc. is a problem for me, I just can not find any. I already tried PrimalScript 2009 but it doesn not work.

       

      What I need is that in following block of code

       

      Set myInDesign = CreateObject("InDesign.Application.CS4")

      Set myDialog = myInDesign.Dialogs.Add

       

      I will get list of all methods/properties after I write the dot after "myInDesign" in second line. But it never worked. I even tried to put "InDesign.Application.CS4/C:\ProgramData\Adobe\InDesign\Version 6.0\cs_CZ\Scripting Support\6.0\Resources for Visual Basic.tlb" line into Options>Text editor>Type libraries.

       

      I am using Windows Vista SP1 and I have Adobe Creative Suite CS4 installed (upgrade from CS3 which was upgraded from CS2)

       

       

      Thanks a lot for any help/suggestion, as I start feeling desperate.

        • 1. Re: VBScript editor with Intellisense/Code Hinting support for Adobe App
          [Jongware] Most Valuable Participant

          When I need cross-application stuff, I start up Word and use its VBA editor. With some addition of, what are they, TLBs? it uses its built-in support for Intellisense and class and property help lookup. Works like a dream -- fortunately, as I'm not that VB savvy.

          • 2. Re: VBScript editor with Intellisense/Code Hinting support for Adobe App
            Matus Grinvalsky Level 1

            Thank you for your advice. I already tried it before (and it is by far the best solution I have), but somehow I do not feel like it is working well. I used to do this in Excel (just hit Alt+F11) as I usualy working with XLS data and generate INDD file based on them.

             

            But it does not seem to work well for me. I go to "Tools>References", check the "Adobe Indesign CS4 Type Library" and then start typing.

             

            I do not think I see all methods/properties for InDesign object as:

            1) I see Dialog property of myInDesign object, but it has no "Add" method (even though I am positively sure that there is such method)

            2) I see all properties which are MS Word specific which had no meaning in context of Indesign.Application object

             

            I use CTRL+J to list properties/methods.

             

            Does this block of code work for you? I mean do you get code hints/intellisense sugestions aftrer you type each dot?

             

            Set myIndesign = CreateObject("InDesign.Application.CS4")
            Set myDialog = myIndesign.Dialogs
            Set myDialog = myIndesign.Dialogs.Add
            myDialog.Cancel = True

             

            Thank for your time

             

            Matus

            • 3. Re: VBScript editor with Intellisense/Code Hinting support for Adobe App
              Kasyan Servetsky Level 5

              Hi Matus,

               

              I use Microsoft Visual Basic 6 to write VB scripts.

              To get code hints:

              1. Add the reference to InDesign (Project > References > select Adobe InDesign CS4 Type Library)
              2. Declare (that is, Dim) variables:

              Dim myInDesign As InDesign.Application
              Dim MyDoc As InDesign.Document
              Set myInDesign = CreateObject("InDesign.Application.CS3")
              Set MyDoc = myInDesign.ActiveDocument

               

              Now when you type myInDesign. , code hint will appear.

               

              You can also use Object Browser to see all InDesign objects, their properties and methods (Choose InDesign library in the top left corner).

               

              After you finish writing a script, remove all Dims, as it can lead to some errors.

               

              Kasyan

              1 person found this helpful
              • 4. Re: VBScript editor with Intellisense/Code Hinting support for Adobe App
                Matus Grinvalsky Level 1

                Hi Kasyan,

                 

                thank you very much for your advice. I assume you start a Visual Basic project, then open Visual Basic file (as you use a VB syntax for Dim).

                 

                1) There is a bit of overhead, but it is certainly worth the time. I need to declare every object variable using Dim, but as I can put all such declaration at the top of the file, I can easily remove it later.

                 

                2) I got Visual Studio to try it, and it keep removing the 'Set' statement, as it stick with Visual Basic (not VBScript) syntax.Only way around for me is to wirite it down later manualy. I thought about having them inserted by some kind of search and replace script, but coments in VB and VBScript all always spanning to the end of line, so all i can do here is make comments so i can quickly find all place which I need to edit. (Or I can replace each such comment and a new line with "Set " automaticaly)

                 

                Otherwise then that, it works as required.

                 

                If there is no better solution found, I will stick with this one.

                 

                But I still hope that I am not the only one writing VBScript code for Adobe apps looking for some code hinting and there is some elegant solution to the problem. If not, what the hack, it is not the first time I am scraching my left ear with my right hand ;-)

                 

                Matus

                • 5. Re: VBScript editor with Intellisense/Code Hinting support for Adobe App
                  Matus Grinvalsky Level 1

                  I contacted also Sapien support (producer of PrimalScript) and submited the typelib.

                   

                  Problem and solution according to Sapien:

                   

                  The (Adobe InDesign CS3) typelib is missing a flag on the component definition, which prevents it from loading and assigning this correctly. It's a simple thing to prevent from our side though as you can see below. This will be included in the next service build (Usually first tuesday of a month).


                  Link for Sapien support thread with working screenshot: http://support.sapien.com/forum/forum_posts.asp?TID=1234

                   

                   

                  So I will wait till next service release adn confirm it is working and then close this thread.

                   

                  Matus

                  • 6. Re: VBScript editor with Intellisense/Code Hinting support for Adobe App
                    cotcodac Level 1

                    I was looking for an answear for intellisense in vbscript for indesign for years...!   I am able to write small scripts for word, excel, for coreldraw thanks to MS VB for applications and its intellisense, but for Adobe indesign I got no help. I saw on the primal script forum link that the problem is actually the typelib adobe provides. The script editor is quite expensive at 300 USD, I am hoping adobe will fix the typelib so we can use intellisense in other script editors - there are quite a few that are cheaper.
                    Anyway, thanks for insisting on this matter - looks like scripters dont miss the intellisense - but for me, a normal user of indesign, with some interest in scripting it is a life saver.

                    • 7. Re: VBScript editor with Intellisense/Code Hinting support for Adobe App
                      Olav Martin Kvern Level 3

                      Hi cotcodac,

                       

                      If you're happy with the editor in VBA, you can get intellisense by adding a reference to the InDesign type library and then using "Dim" to declare variables as being of a specific type (e.g., InDesign.Document). This is shown in the Scripting Tutorial. You'll get auto-completion/intellisense for all of the variables you declared using Dim.

                       

                      If you do this, make sure you comment out the "Dim" lines before running/deploying the script--they can lead to trouble, and they're not supported in VBScript.

                       

                      I know what you mean, though--I like VBSEdit, and it's unlikely we'll have auto-complete there anytime soon.

                       

                      Thanks,

                       

                      Ole

                      • 8. Re: VBScript editor with Intellisense/Code Hinting support for Adobe App
                        cotcodac Level 1

                        Hello Olav

                        I know you are too busy and I am too novice to discuss this further... I know that there's a huge difference in how primalscript helps me with colors and intellisense and how VBA helps. I know how to enable the ID typelib in VBA, but it just isn't as helpful as it is with script for word for example. We could open a sample script with VBA and see where I get help when I press "." - I can assure you that primalscript gives sugestions everytime. Now I dont even have to enable the typelib for indesing (in primalscream).

                        As I said I am a novice in scripting - it would be hard to talk about why those 2 are different (PS 2009 and VBA). I am really considering buying PS 2009...

                        Thank you Matus for being more persistent than me...

                        • 9. Re: VBScript editor with Intellisense/Code Hinting support for Adobe App
                          Matus Grinvalsky Level 1

                          Hi Everyone!

                           

                          As I have said, I waited for next service release, which is as of now PrimalScript 2009 version 5.0.614 and I did some testing with it.

                           

                          Results:

                           

                          WinXP EN Professional

                          - Just pointing PrimalScript 2009 to typelib, no creative suite installed, working

                          - Installed Creative Suite CS3 Czech (trial mode) - Working, no need to setup anything

                          - Installed Creative Suite CS3 + CS4 Czech (trial mode) - Need to point PrimalScript 2009 to correct typelib, then 100% working

                           

                          Windows Vista SP1 Ultimate EN (in trial/not activated mode)

                          - Just pointing PrimalScript 2009 to typelib, no creative suite installed, working

                          - Installed Creative Suite CS3 Czech (trial mode) - Need to point PrimalScript 2009 to correct typelib, then 100% working

                          - Installed Creative Suite CS3 + CS4 Czech (trial mode) - Need to point PrimalScript 2009 to correct typelib, then 100% working

                           

                          Windows 7

                          I am not planning to use Win7 in near future, so I did not not run any test on it.

                           

                          Windows Vista SP1 Home Premium Slovak (fully activated)

                          - Installed Creative Suite CS3 + CS4 Czech (full mode) - Not working. This is my main machine. It is Creative Suite CS2 upgraded to CS3 then CS4 (it is running for years without reinstall). I use CS3/CS4 side by side for some older projects. There are still references to CS2 in registry. I tried pointing PrimalScript 2009 to correct typelib, but to no avail. My conclussion is that there is someting messed with its config or registry, but I am pretty sure it would run after complete system reinstall.

                           

                          Both WinXP EN Pro and Vista SP1 Ultimate EN were clean install into MS Virtual PC 2007, with only Creative Suite and PrimalScript 2009 5.0.614 installed into each machine so I made sure there are no other issues involved.

                           

                          As I spend 80% of my time with developement of websites and scripting of MS Office/Creative Suite, I have some virtual machines set up for testing purposes. I will use one of them for development in PrimalScript and move it to main (real) Windows Vista Home Premium Slovak installed once I will decide to completely reinstall it. The need for seting up the typelibray link is no deal for me, as it is working as expected then, and I expect a lot ;-)

                           

                          So problem solved, I found o program I will use. There may be others which do better or are cheaper (but I do not know about any) but $299 is not a big issue when I get what I want.

                           

                          P.S.: The solution with making VBScript code with VBA declaration (using Dim) is not a solution I like, as I would need to comment it out everytime I run/edit  the script and it would be pain in the *** while debugging it as i would need to do lot of comment/uncomment cycles and i can use my ime better then doing the monkey work as some fo the scripts I write are quite huge and I prefer to build them incrementaly and test/debug a lot.

                           

                          I wish to thank everyone for their help and suggestions,

                           

                          Matus

                          • 10. Re: VBScript editor with Intellisense/Code Hinting support for Adobe App
                            nyturn

                            I'm happy with ExeScript Pro VBScript Editor. It has a number of useful functions, allowing to edit, compile and debug scripts, as well as search and apply COM objects. Also it can convert your script into exe file. The price is $99

                            • 11. Re: VBScript editor with Intellisense/Code Hinting support for Adobe App
                              John_Clayton

                              For me, the best one is definitely Vbsedit

                              It has intellisense, debugger, tons of samples and it is very simple to use.

                              You don't have to pay anything if you don't use the debugger

                              • 12. Re: VBScript editor with Intellisense/Code Hinting support for Adobe App
                                Olav Martin Kvern Level 3

                                Hi John_Clayton,

                                 

                                I also like VBSEdit a lot, but my version (3.3.9) can't add a reference to the InDesign model, and so can't get intellisense for InDesign scripting terms. Has this changed in newer versions?

                                 

                                Thanks,

                                 

                                Ole