Sign in to follow this  
Followers 0
DaveToland

Wait Until Status Message Changes ..?

12 posts in this topic

How do I cause the script to wait for an on-screen message to change.

I have a client application that logs into a server, there is a status message on screen which cycles through "Not Connected", "Attempting to Connect to IP: XxXXXX", "Connecting..." and finally "Connected".

I want the script to pause/wait until the "Connected" status appears..

Any ideas?

Cheers

Dave

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

How do I cause the script to wait for an on-screen message to change.

I have a client application that logs into a server, there is a status message on screen which cycles through "Not Connected", "Attempting to Connect to IP: XxXXXX", "Connecting..." and finally "Connected".

I want the script to pause/wait until the "Connected" status appears..

Any ideas?

Cheers

Dave

I would start by trying out this script. It will return all the ClassNameNN's by their text. Then you should be able to use ControlCommand() to read the text to see if it matches what you want. Edited by big_daddy

Share this post


Link to post
Share on other sites

I get a error when running the script:

Line 86 (File "C:\AutoIT Scripts\FindClassesByText.au3");

Func BuildTree(Const ByRef $TextClasses)

Func BuildTree(^ ERROR

Error: Badly Formed "Func" statement.

???

Share this post


Link to post
Share on other sites

I get a error when running the script:

Line 86 (File "C:\AutoIT Scripts\FindClassesByText.au3");

Func BuildTree(Const ByRef $TextClasses)

Func BuildTree(^ ERROR

Error: Badly Formed "Func" statement.

???

Are you using the latest beta version?

Share this post


Link to post
Share on other sites

Are you using the latest beta version?

OK, installed that.

Now I get another error saying:

"Error reading the file:

GUITreeView.au3"

:think:

Share this post


Link to post
Share on other sites

OK, installed that.

Now I get another error saying:

"Error reading the file:

GUITreeView.au3"

:think:

Start-->All Programs-->AutoIt v3-->beta-->Toggle AU3 Beta

Then try running the script again.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Ok, got it working.

Predictably, I have hit another wall... :think:

Bit of a weird setup here.. The text is actually a combo box trigger showing connection status (you can drop it down and choose Busy, Inactive, Away etc), however, when the application is logging in this area just shows a status message (i.e. Connecting to IP: ...) - this status message is not an option in the combo box, and when you click it the combo box opens with all options greyed out.

Anyways - the long and short of it is that the text "Connected" text, does not appear in the readout of the Find Classes script. I'm guessing it may be a 'Container' ..??

I've included some screenshots, hopefully this will make the problem a little clearer

AutoScript_A.JPG shows the application logging in. You can see towards the top left it is logging into an IP address. This is the combo box trigger...

AutoScript_B.JPG shows the greyed out combo box - the application has not logged in yet.

AutoScript_C.JPG shows the application logged in. The text has changed to 'Connected' - this is an option in the combo box which is now available.

Depending on network load etc, it can take a varying amount of time to get to this point. It is at this point that I want to script to carry on the automation, but not before.

You see my dilemma?

Thanks v.much for your help so far, I appreciate it a lot.

Cheers

Dave

Edited by DaveToland

Share this post


Link to post
Share on other sites

I initially thought that the MAINWINDOW_STATUS_CONNECTED2 would not help as it says this whatever the status, although during login this text actually reads MAINWINDOW_STATUS_REGISTERING

So, I think it will work if I continue the script when this changes from REGISTERING to CONNECTED2.

I have had a read through the helpfile for 'ControlCommand' but I cannot work out what I should do.

Do I use the "FindString" command?

Sorry to be a pain.... :think:

Dave

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

I tried this:

Do

$cmd = ControlCommand ("Ingenious", "", 5230, "FindString", "MAINWINDOW_STATUS_CONNECTED2")

Until $cmd <> 0

MsgBox(0, "Message", $cmd)

but it doesn't ever show the message, even when it is connected....

Edited by DaveToland

Share this post


Link to post
Share on other sites

Try running:

start->program files->Auto Itv3->AutoIt Window Info

run the progrm and while connecting watch the window text section in the window info tool...it is possible that there is hidden window text displaying the status. If not you could try doing a pixel search for that green circle that appears next to connected once you are connected.


_____________________________________________________"some people live for the rules, I live for exceptions"Wallpaper Changer - Easily Change Your Windows Wallpaper

Share this post


Link to post
Share on other sites

I tried this:

Do

$cmd = ControlCommand ("Ingenious", "", 5230, "FindString", "MAINWINDOW_STATUS_CONNECTED2")

Until $cmd <> 0

MsgBox(0, "Message", $cmd)

but it doesn't ever show the message, even when it is connected....

"MAINWINDOW_STATUS_CONNECTED2" is not the classname, it is the text reference to it. You need to expand the tree for "MAINWINDOW_STATUS_CONNECTED2" and use the classname with ControlCommand().

Share this post


Link to post
Share on other sites

I got it working like this in the end:

Do

$text = WinGetText ("Ingenious", "")

$done = StringInStr ($text, "MAINWINDOW_STATUS_CONNECTED2")

Sleep (1000)

Until $done <> 0

Cheers for your help guys, much appreciated...

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