Sign in to follow this  
Followers 0
Blue_Drache

Any idea why this window detection

6 posts in this topic

I am attempting to automate a series of menus written in VB6.0. The For/Next is there to catch the different internal button numbers. The text rarely (if ever) changes, but the ThunderRT6CommandButton# might. As far as I can tell, the code for this is correct...but it's timing out every time. What am I doing wrong?

Attached is the snippet and the .gif of the window, including the AutoIt Spy.

Snippet:

Opt("WinTitleMatchMode", 4)

If WinWait("Chapter List", "Home", 2) = 0 Then
    MsgBox(0, "Error", "Timeout Error")
    Exit
EndIf
For $counter = 1 To 50
    If StringInStr(ControlGetText("Chapter List", "Home", "ThunderRT6CommandButton" & $counter), "Requests TO Host/Par") > 0 Then
        ControlClick("Chapter Selector", "BlueCard", "ThunderRT6CommandButton" & $counter, $primary, 1)
        ExitLoop
    EndIf
Next

Image:


Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites



ControlGetText ( "title", "text", controlID )

Have you tried "classname=ThunderRT6CommandButton" for the title parameter or control ID as you are using Opt("WinTitleMatchMode", 4)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

ControlGetText ( "title", "text", controlID )

Have you tried "classname=ThunderRT6CommandButton" for the title parameter or control ID as you are using Opt("WinTitleMatchMode", 4)

I'm not even getting to that point yet where I have to worry about button classnames ... Moot point anyway, since I'm worrying about a WINDOW title/classname, not a BUTTON title/classname.

It doesn't matter which WinTitleMatchMode I'm in either. No mode seems to work. At all.

Edited by Blue_Drache

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Opt('WinTitleMatchMode', 4)
Opt('WinSearchChildren', 1)
If Not WinWait('classname=ThunderRT6FormDC', '', 2) Then 
    MsgBox(16, 'Error', 'Timed Out')
    Exit
EndIf
MsgBox(64, 'Info', 'Window found')

Edit:

I had the wrong params in there ... oops.

Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Thank you, Smoke, that worked. I'm usually reluctant to use "classname=WindowClassName" in these type of scripts because there's a series of 5 windows with the same classname after each button press. The weird part is...I didn't change the rest of my code and my method worked just peachy for all the other windows. Just the first one was being stubbron. Go figure.

Either way, thanks for the help!


Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites

Thank you, Smoke, that worked. I'm usually reluctant to use "classname=WindowClassName" in these type of scripts because there's a series of 5 windows with the same classname after each button press. The weird part is...I didn't change the rest of my code and my method worked just peachy for all the other windows. Just the first one was being stubbron. Go figure.

Either way, thanks for the help!

NP, but treat the classname= just like you would a window title. If you are trying to find the unique one (window) then just use the text portion to help your situation (which I'm sure you've done).

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
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
Sign in to follow this  
Followers 0