I'm having a bit of a challenge... I'm a little new to VB.net as I've always used VB6 in the past but a few things have changed obviously. I'm trying to make my program open two external programs, one after the other. The code did so until I added the WaitForInputIdle and SendWait commands(I'm trying to open the program and automate its brief use from this other program using SendKeys). Now both open almost immediately, who the sendkeys function does do its job to the first one accordingly. The REAL problem however, isn't in it even openning both at ones. The problem is, once program 1 finishes, followed by program 2 finishing, the program is SOMEHOW stuck in a loop and just keeps reopenning both programs the same way it was. I already put in a variable at the beginning that incremented each time a program was openned, and it resets after the 2nd program so its somehow looping the code but i have no loop. This module is only connected to a push button to start it. Any ideas? Maybe a better way to do this? Thanks a ton!
Here's my code so far:
Private Function ExtProgRun() As Boolean
Dim myprocess as new System.Diagnostics.Process()
myprocess.startinfo.filename = "./apps/program1.exe"
myprocess.start
myProcess.WaitForInputIdle
System.Windows.Forms.SendKeys.SendWait("{ENTER}")
myProcess.WaitForExit()
myProcess.Close()
myprocess.startinfo.filename = "./apps/program2.exe"
myprocess.start
myProcess.WaitForExit()
myProcess.Close()
End Function
Here's my code so far:
Private Function ExtProgRun() As Boolean
Dim myprocess as new System.Diagnostics.Process()
myprocess.startinfo.filename = "./apps/program1.exe"
myprocess.start
myProcess.WaitForInputIdle
System.Windows.Forms.SendKeys.SendWait("{ENTER}")
myProcess.WaitForExit()
myProcess.Close()
myprocess.startinfo.filename = "./apps/program2.exe"
myprocess.start
myProcess.WaitForExit()
myProcess.Close()
End Function