Forum Discussion
tristaanogre
11 years agoEsteemed Contributor
While, technically, it should work, the code you have posted is not exactly how I would recommend it. You have two wait commands present and so there's the possiblity that one or the other will end up with a "Does not exist" error that will cascade.
Sys.WaitProcess("ApplicationName",2000,1).WaitWinFormsObject("ApplicationName",2000).WinFormsObject("MdiClient", "");
I would change your code to the following. Note this is Pseudo code, not necessarily in a particular language
The idea is that you test for exist each time you call a "Wait" method.
Sys.WaitProcess("ApplicationName",2000,1).WaitWinFormsObject("ApplicationName",2000).WinFormsObject("MdiClient", "");
I would change your code to the following. Note this is Pseudo code, not necessarily in a particular language
MyAppProcess = Sys.WaitProcess("ApplicationName", 2000, 1)
If MyAppProcess.Exists then begin
MyFormObject = MyAppProcess.WaitWinFormsObject("ApplicationName", 2000)
if MyFormObject.Exists then
MyMDIClient = MyFormObject.WinFormsObject("MdiClient","")
else
Log.Warning("My Form object does not exist")
end
else
Log.Warning("The process does not exists")
The idea is that you test for exist each time you call a "Wait" method.
Related Content
Recent Discussions
- 4 hours agoSvetaG