How to handle the return of Shell.Execute commands?

I wonder what code is needed to best process the return of a Shell.Execute command (any):

Var sh As New Shell
While sh.IsRunning
  App.DoEvents //necessary ?
  sh.Poll //necessary ?
Wend
System.DebugLog(sh.Result)

Thanks.

The documentation says (Here:

If sh.IsRunning Then
  sh.Poll
End If

Below that entry, you have more examples on how do that. (get the result in a TextField for example).

Since the default mode for a shell is Synchronous, the while loop is completely unnecessary. By the time the while statement is reached, the shell is complete.

If your concern is to keep the UI responsive, run the shell in Async mode and handle the results in DataAvailable.

1 Like