weevil Posted June 22, 2022 Share Posted June 22, 2022 (edited) Hi everyone, I am trying to automate the creation of sessions with mobaXterm and the buttons within the application don't appear to have separate controls. Attached screenshot highlights a controlID called TsPanel5, but each individual section within that entire bar aren't separate - its all one ControlID. I have tried this: global $exe = ShellExecute("D:\MobaXterm.exe") local $hWnd = WinWait("[CLASS:TMobaXtermForm]") WinActivate($hWnd) ControlClick($hWnd, "","TsPanel5", "left", 1, 30, 26) local $hWnd = WinWait("Session settings") WinActivate($hWnd) ControlClick($hWnd, "","TsPanel1", "left", 1, 27, 32) By using the ControlID Coords I thought this would be easily achievable, but it's very flakey. When the app loads it seems to immediately lose focus. If i run the script with the application running it seems to click the button - but again, only like 50% of the time. Does anyone have any suggestions on making this reliable? I am really loathed to use mouse coords as this is essentially the same just limited to within the ControlID. EDIT: I've also noticed that it doesn't seem to wait for the windows? If the first controlclick wasn't successful I'd expect the script to wait indefinitely for the "Session settings" window - but it doesn't, the script exits without error. Thanks! Edited June 22, 2022 by weevil Link to comment Share on other sites More sharing options...
weevil Posted June 22, 2022 Author Share Posted June 22, 2022 I've done a bit more digging - it seems a LONG sleep (5 seconds) after the first WinActivate seems to do the trick. I guess the application is still loading things. Is there a better way of doing this rather than arbitrary sleeping? Link to comment Share on other sites More sharing options...
junkew Posted June 22, 2022 Share Posted June 22, 2022 Try with uia automation. Faq 31 can get you started FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
mikell Posted June 23, 2022 Share Posted June 23, 2022 20 hours ago, weevil said: I guess the application is still loading things So you might try WinWaitActive, and ControlFocus before the ControlClick Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now