1 Reply Latest reply on Jan 16, 2012 12:59 PM by a.sassano

    DxDesigner 7.9.2: Using a script with arguments



      I want to create a universal script in order to generate PDFs out of DxDesigner. I would like to give the script an argument, whether the PDF is black or color.


      I use following script to read out the argument:

      Set WshShell = WScript.CreateObject ("WScript.Shell")
      Set Ag = Wscript.Arguments 
      if Ag.count < 1 Then
      End if
      color = Ag.item(0)
      msgbox "the PDF will be printed in" & color


      However if I try to call the script via "run ...vbs black" I get an error message:


      Source:'Laufzeitfehler in Microsoft VBScript'

      Line:1  Char:0

      Error:0x800a01a8  'Objekt erforderlich: 'WScript''


      What am I doing wrong?

        • 1. Re: DxDesigner 7.9.2: Using a script with arguments

          Hello Markus,


          >>>What am I doing wrong?



          The "run...black.vbs" command  use ICScript and does not support parameters. It does not work.


          Write your own run command.



          Include it in the scripts.ini to be active all the time.


          RegisterOLECommand "runvbs", "User run method", false, Scriptengine


          function runvbs(RestOfLine)

                  Set WshShell = CreateObject("WScript.Shell")

                  WshShell.Run "wscript.exe " & RestOfLine, , true

          End function

          Scripting.DontExit = True




          Call your Scripts using

                         runvbs c:\test\test2.vbs hallo


          msgbox wscript.scriptfullname & " " & Wscript.Arguments(0)



          Maybe not very nice. But it works.


          Best Regards


          1 of 1 people found this helpful