Hey everybody,
Anyone wishes to give me a hand here?
I've been trying to automate an application using visual basics. I've reached a wall! I know this is probably a really stupid error by me, but I'd appreciate if someone helps:
I am automating this program, which I need to selects a few tables and repairs them. After opening the application and sending some keystrokes, I have to wait till the application verifies the tables, and so since I donât know how long this waiting time is, I decided to use a loop until a msgbox pops up on the screen that indicates verification is completed. Then I would need to click ok (send space key).
My problem is the loop section. I keep getting an infinite loop. Here is what I have so far:
Code:
Private Sub sendSpaceKey()
' checks until the specified window class pops up '
' retreive name of class on the active window '
' wait for the next pop up box '
Do While (className <> "TmoduleForm" Or className <> "TmessageForm")
className = getClass(GetForegroundWindow)
Loop
' send space key '
Do While (className = "TmoduleForm" Or className = "TmessageForm")
className = getClass(GetForegroundWindow)
SendKeys "{pace}", True
Loop
End Sub
I have tested all the other functions and everything works fine. Basically what happens here is that, I want to check for the active window and get the class name of that type of window. If it is the class im looking for then send a keystroke....
I'd appreciate if someone responded quickly!
Sam Gharnagh
Jr. Programmer Analyst at MOH
Comp Sci at UofW