2
votes

How to convert the following VBScript code to use with JScript in TestComplete? We are trying to invoke the application/.exe using Windows Script Host functions instead of the predefined functions in TestComplete.

strExe = "C:\whatever\myprogram.exe -h1 -d33"
Set objShell = CreateObject("WScript.Shell")
Set objScriptExec = objShell.Exec(strExe)
strExeOut = objScriptExec.StdOut.ReadAll
2

2 Answers

3
votes

Here's the JScript version:

var strExe = "C:\\whatever\\myprogram.exe -h1 -d33";
var objShell = new ActiveXObject("WScript.Shell");
var objScriptExec = objShell.Exec(strExe);
var strExeOut = objScriptExec.StdOut.ReadAll();
1
votes

I've written a blog article on this. You can find it here: http://blog.dimaj.net/2011/02/howto-start-application-from-jscript-and-specify-start-in-folder-attribute/

Aside from launching an application, I'm also describing how to set the 'start in' option since some application must have that option set.