Forum Discussion

googleid_117429's avatar
googleid_117429
Occasional Contributor
14 years ago

Built in function to run a file

Hi,

  I have to run a application/file stored in a path i used the following code

Set ws =WScript.CreateObject("Wscript.Shell")

ws.Run("C:\xyz\someFile\kd_gl.py")



But test complete Wscript Object required



Is there a built in function such as SystemUtils.Run(path) as in QTPscript



thanks,

Biji

3 Replies

  • Hi Biji,



    The WScript.CreateObject() syntax is used in VBScript scripts that run directly from Windows (via Windows Script Host). In VBScript code that is run in TestComplete, you need to use CreateObject() or Sys.OleObject():

    Call CreateObject("Wscript.Shell").Run("C:\xyz\someFile\kd_gl.py")

    ' or

    Call Sys.OleObject("Wscript.Shell").Run("C:\xyz\someFile\kd_gl.py")


    You can also run applications, such as your tested application, via TestedApps. For example:

    where MyApp is an item in TestedApps that specifies the needed executable file and its parameters.

  • Hi Biji,


    You have to create a variable with type as object in Project variables.



    for that, Duble Click on Project name---> Test items tab will open---> Select the variable tab---->Right click ----> select new item--->create one object with the name "Wscript".



    Regards,

    Srini.