wnd.appExecute Method


exitCode = appExecute(strCommandLine, strAppTitle, strStartIn, bWait);

If bWait is set to true then this function excutes the specified command line and returned the application's exit code. Otherwise it executes the command line and then looks for the main window of the application. Unless specifically closed (with appRelease(true)) the application will continue to run even after the script terminates.

Parameters

strCommandLine
Required. The command line (.exe name and optional command line arguments) to execute.
strAppTitle
Optional. The title of the window to attach. Q1 will look for a window belonging to the new application, whose title matches the specified string. The string can be a regular expression pattern.
strStartIn
Optional. The application will be started in this directory. If it's not specified the application is started in the directory where the exe file is located.
bWait
Optional. If this is true then Q1 will wait until the specified application has finished executing.
exitCode
Returned. The exit code returned by the application, only valid if bWait was set to true.

Example

// Create the object used to access the application
var app = new ActiveXObject("Wrappers.WNDWrapper");
app.appExecute("SampleWinCtrls.exe");

// Alternatively if the app is already started we could attach it
//app.appAttach("\\.*SampleWinCtrls"); // example of a regular expression match

// Create an instance of the main window object
var SampleWindow = new mainwnd(app);
SampleWindow.testAll();

// Close the application
app.appRelease(true);
		

See also

wnd Overview | wnd.appAttach | wnd.appRelease

 


© 2003 Lightweight Technologies. All rights reserved.