-
I'm Running a DOS Appl which I have in vbHide and i am redirecting the output to a file.
ExecHandle = Shell(BatFile, vbHide) ' run the bat
1) How colud i know if my bat file is finished executing ?? ( i want to read the output).
2) How do i close Dos appl??
Best Regards
-
1. At the end of your bat, create a file (like Finish.txt)
In your app, test the existence of this file. When it existe, you know that the app has finish. (don't forget to delete this file before the next call to the Dos app)
2. I working on..
-
1. see up
2. maybe in using the senkey but i don't know if it work because the app is hiden
Code:
ExecHandle = Shell(BatFile, vbHide)
'
' Wait the finishing of the Dos App
'
AppActivate ExecHandle
SendKeys "%{F4}", True
-
Another way
Code:
Global Const SW_SHOWNORMAL = 1
Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Sub MyProc()
'
'
ExecHandle = Shell(BatFile, vbHide) ' run the bat
'
' Waiting the end of the Dos App
'
' Show the Dos window
ShowWindow ExecHandle, SW_SHOWNORMAL
' Active the Dos window
AppActivate ExecHandle
' Close the Dos window (send Alt-F4)
SendKeys "%{F4}", True
'
'
'
End Sub
-
KWell - Thanks, I will try it.