5 Replies Latest reply on Aug 27, 2008 5:49 AM by hm_arul

    app.doscript Error

    hm_arul Level 1
      Hi scripters

      Whats wrong in this code!

      main.jsx

      var myscr = new File('D:\1\book\my.vbs')
      app.doScript( myscr, ScriptLanguage.visualBasic)

      my.vbx

      MsgBox("Hi")

      The following error thrown

      ---------------------------
      Adobe InDesign
      ---------------------------
      JavaScript Error!

      Error Number: 30483
      Error String: Cannot compile script.
      Line: 25
      Source: app.doScript( myscr, ScriptLanguage.visualBasic)
      ---------------------------
      OK
      ---------------------------

      Please advice me

      thanks in advance

      regards
      a r u l
        • 1. Re: app.doscript Error
          Level 1
          Well, on face value, the file my.vbs either doesn't contain a valid script. (Or perhaps the file doesn't exist -- I'm not sure what error that would cause.)

          You are running on Windows, right?

          Dave
          • 2. Re: app.doscript Error
            hm_arul Level 1
            Yes Dave I am running Windows XP and CS2

            and this is the my.vbs content it's working good alone but inside the javascript!

            my.vbx

            MsgBox("Hi")
            • 3. Re: app.doscript Error
              Level 1
              Not being a VB expert, the only thing I wonder about is that word "new" in the first statement. I'd write:

              var myscr = File('D:\1\book\my.vbs');

              Then, I'd add:

              if (myscr.exists) {
              // insert doscript here.
              }

              Dave
              • 4. Re: app.doscript Error
                Kasyan Servetsky Level 5
                Hi Dave and Arul,

                "new" operator is optional:
                new File - always returns a File object
                File - can return a Folder object

                The following code works for me:
                -----------------------------------------------------------------
                Rem VBScript
                Set myInDesign = CreateObject("InDesign.Application.CS3")
                MsgBox("Hi")
                -----------------------------------------------------------------
                // JavaScript
                var myscr = new File('/C/1/book/my.vbs');
                if (myscr.exists) {
                app.doScript(myscr, ScriptLanguage.visualBasic)
                }
                -----------------------------------------------------------------
                Kasyan
                • 5. Re: app.doscript Error
                  hm_arul Level 1
                  Hi Kasyan and Dave

                  thanks for your code, now it works good.

                  thanks again

                  regards
                  a r u l