When using the below code to send keystrokes to another application, all the waits seem to happen at once, and then all the SendKeys happen right after another without any waiting, is there a way to prevent that from happening?
Essentially I am telling my mouse cursor to select a navigation header, click, find the report named "Report", open the properties (Alt O) and then select the appropriate textbox by tabbing to it. However, after the click, nothing happens for 4 seconds and then all the SendKeys seem to get executed all at once.
VB.NET:
Dim intMouseX As Integer Dim intMouseY As Integer
intMouseX = CInt(Label1.Text)
intMouseY = CInt(Label2.Text)
SetCursorPos(intMouseX, intMouseY)
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
Thread.Sleep(500)
SendKeys.Send("Report")
Thread.Sleep(1000)
SendKeys.Send("%o")
Thread.Sleep(3000)
SendKeys.Send("{TAB}")
SendKeys.Send("{TAB}")
SendKeys.Send("{TAB}")
SendKeys.Send("{TAB}")
SendKeys.Send("{TAB}")
SendKeys.Send("{TAB}")
Essentially I am telling my mouse cursor to select a navigation header, click, find the report named "Report", open the properties (Alt O) and then select the appropriate textbox by tabbing to it. However, after the click, nothing happens for 4 seconds and then all the SendKeys seem to get executed all at once.