Having problems with your account or logging in?
A lot of changes are happening in the community right now. Some may affect you. READ MORE HERE

Is using ShellExecute similar to using the Invoke method in SilkTest?

Is using ShellExecute similar to using the Invoke method in SilkTest?

Using the Windows SDK function ShellExecute allows you to fully controlwhich program to startup, of course, it depends on the certain task.For instance, if you need to run a batch file, wait until it terminatesand then check the data in the output, it is better to use the SYS_Execute() function.

If you need to run only executable files and want to havecompatibility between different SilkTest versions, method Start() isthe most suitable.

And if you want to open files of different formats, or to run executable file and continue executing your script without waiting for the executable file to finish working, it would be better to use the ShellExecute function. More information on using the ShellExecute function can be found in:

An alternative to using SYS_Execute to execute commands from SilkTest (alternative to using SYS_Execute to execute commands from SilkTest)

Why does ShellExecute not work with SilkTest International? (Using wide-byte version of ShellExecute)

How do I launch an application without using the Default BaseState or Application States? (Launching an application without using Default BaseState or Application States).

Therefore the ShellExecute function can open files of different formats or to run executable files, but in the case where you would like SilkTest to wait for the application to open before executing the scripts, this is where the invoke method comes into play. However, youcan use wait statements with ShellExecute to wait for the applicationto open, however, this is NOT machine independent (i.e. loading of the application may differ on different environments).

The Invoke method invokes the current dialog or window, using information specified in the declaration to determine how to invoke the object. For a dialog, the declaration must contain the wInvokevariable, which defines the menu, menu item, or push button that invokes the dialog. For a ChildWin, wInvoke can be either a menu or a menuitem.

When you use the Invoke method for a MainWin, Invoke calls theStart method and passes to it parameters specified in the declaration for the MainWin:

sCmdLine variable: a string that defines the command line used toinvoke the application. The MainWin declaration must contain a definition for this variable in order to use the Invoke method to invoke the main window.

sdir variable: a string that defines the working directory of the application when it is invoked. This variable is optional.

bextensionReady: a Boolean that, if set to TRUE, indicates thatSilkTest should wait until the application???s extension has finished registering. This variable is optional.

nInvokeTimeout: an integer that specifies the number of seconds that SilkTest waits fo the main window of the application to appear.This variable is optional.


Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Top Contributors
Version history
Revision #:
1 of 1
Last update:
‎2013-02-15 19:36
Updated by:
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.