shell can be used to start a program (application).
shell path
shell path, windowStyle
The returned task id is a double (!) and identifies the started process (and is sometimes also referred to as PID or process ID).
This task id can for example be used in the appActivate statement.
windowStyle is one of
vbHide
0
vbNormalFocus
1
vbMinimizedFocus
2
The default if omitted
vbMaximizedFocus
3
vbNormalNoFocus
4
vbMinimizedNoFocus
6
In the following example, shell is used in the startTasksub to start an instance of notepad.exe.
In end task, taskkill.exe is executed with the /PID flag to kill the freshly started notepad process.
option explicit
global PID as long
sub startTask() ' {
PID = shell("notepad.exe", vbNormalNoFocus)
debug.print("process id = " & PID)
end sub ' }
sub stopTask() ' {
shell "taskkill /pid " & PID
end sub ' }