Jump to content

Tricky application with no real controls help


Recommended Posts

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!

mobaXtermscreenshot1.PNG

Edited by weevil
Link to comment
Share on other sites

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...