DaveToland Posted April 26, 2006 Share Posted April 26, 2006 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 Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted April 26, 2006 Moderators Share Posted April 26, 2006 (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?CheersDaveI 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 April 26, 2006 by big_daddy Link to comment Share on other sites More sharing options...
DaveToland Posted April 26, 2006 Author Share Posted April 26, 2006 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. ??? Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted April 26, 2006 Moderators Share Posted April 26, 2006 I get a error when running the script:Line 86 (File "C:\AutoIT Scripts\FindClassesByText.au3");Func BuildTree(Const ByRef $TextClasses)Func BuildTree(^ ERRORError: Badly Formed "Func" statement.???Are you using the latest beta version? Link to comment Share on other sites More sharing options...
DaveToland Posted April 26, 2006 Author Share Posted April 26, 2006 Are you using the latest beta version?OK, installed that.Now I get another error saying: "Error reading the file:GUITreeView.au3" Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted April 26, 2006 Moderators Share Posted April 26, 2006 OK, installed that.Now I get another error saying: "Error reading the file:GUITreeView.au3" Start-->All Programs-->AutoIt v3-->beta-->Toggle AU3 BetaThen try running the script again. Link to comment Share on other sites More sharing options...
DaveToland Posted April 26, 2006 Author Share Posted April 26, 2006 (edited) Ok, got it working. Predictably, I have hit another wall... 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 April 26, 2006 by DaveToland Link to comment Share on other sites More sharing options...
DaveToland Posted April 26, 2006 Author Share Posted April 26, 2006 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.... Dave Link to comment Share on other sites More sharing options...
DaveToland Posted April 26, 2006 Author Share Posted April 26, 2006 (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 April 26, 2006 by DaveToland Link to comment Share on other sites More sharing options...
Don N Posted April 26, 2006 Share Posted April 26, 2006 Try running:start->program files->Auto Itv3->AutoIt Window Inforun 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 Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted April 26, 2006 Moderators Share Posted April 26, 2006 I tried this:Do $cmd = ControlCommand ("Ingenious", "", 5230, "FindString", "MAINWINDOW_STATUS_CONNECTED2")Until $cmd <> 0MsgBox(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(). Link to comment Share on other sites More sharing options...
DaveToland Posted April 27, 2006 Author Share Posted April 27, 2006 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... 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