Jaw7 Posted February 1, 2010 Share Posted February 1, 2010 Here is my script. The ControlCommand in second line is dealing with a combobox. When it makes its seleciton, my program will automatically open "Dialog 2". But it seems that the script stucked at WinWaitActive while actually the dialog is active. I'm sure it's not a matching problem. Because: When the script stucked, I move my mouse and close manually "Dialog 2", and select the combobox to make it open "Dialog 2" again. This time, WinWaitActive find its target and the script just passed. So have you ever faced this kind of problems? WinWaitActive("Dialog 1") ControlCommand("Dialog 1","",225,"SelectString","string") WinWaitActive("Dialog 2") $st = ControlSetText("Dialog 2", "", 7000, "11" ) MsgBox(1,"test",$st) Link to comment Share on other sites More sharing options...
omikron48 Posted February 1, 2010 Share Posted February 1, 2010 What I'm guessing is that Dialog 2 isn't being activated or set as the active window at all. Or Dialog 2 isn't active long enough for your script to notice it being active. Link to comment Share on other sites More sharing options...
Jaw7 Posted February 2, 2010 Author Share Posted February 2, 2010 What I'm guessing is that Dialog 2 isn't being activated or set as the active window at all. Or Dialog 2 isn't active long enough for your script to notice it being active. Thanks for the reply. After that, I tried to add WinActivate before WinWaitActive. Make the whole script like this: WinWaitActive("Dialog 1") ControlCommand("Dialog 1","",225,"SelectString","string") WinActivate("Dialog 2") WinWaitActive("Dialog 2") $st = ControlSetText("Dialog 2", "", 7000, "11" ) MsgBox(1,"test",$st) But it act just like the previous one. Link to comment Share on other sites More sharing options...
Bert Posted February 2, 2010 Share Posted February 2, 2010 what happens if you use winexist to see if the window is there? The Vollatran project  My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
herewasplato Posted February 2, 2010 Share Posted February 2, 2010 So have you ever faced this kind of problems?Yes. Try adding WinWait:WinWaitActive("Dialog 1") ControlCommand("Dialog 1","",225,"SelectString","string") WinWait("Dialog 2") WinActivate("Dialog 2") WinWaitActive("Dialog 2") $st = ControlSetText("Dialog 2", "", 7000, "11" ) MsgBox(1,"test",$st) If that does not work for you, add timeouts and check the return from each Win... line. [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
Jaw7 Posted February 3, 2010 Author Share Posted February 3, 2010 Yes. Try adding WinWait:WinWaitActive("Dialog 1") ControlCommand("Dialog 1","",225,"SelectString","string") WinWait("Dialog 2") WinActivate("Dialog 2") WinWaitActive("Dialog 2") $st = ControlSetText("Dialog 2", "", 7000, "11" ) MsgBox(1,"test",$st) If that does not work for you, add timeouts and check the return from each Win... line. I tried this. WinWait also can't find Dialog 2. I guess WinExists can't work either. And I just notice that Dialog 1 and Dialog 2 use a same class name. Is that the reason? Link to comment Share on other sites More sharing options...
herewasplato Posted February 4, 2010 Share Posted February 4, 2010 I tried this. WinWait also can't find Dialog 2. I guess WinExists can't work either.And I just notice that Dialog 1 and Dialog 2 use a same class name. Is that the reason?I'm not sure, but I've had some windows that AutoIt could never find the title. Last resort might be the Pixel functions. Once you know that it is there, then you might have to click on it via AutoIt and do the steps you mentioned here:When the script stucked, I move my mouse and close manually "Dialog 2", and select the combobox to make it open "Dialog 2" again. This time, WinWaitActive find its target and the script just passed. [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
omikron48 Posted February 4, 2010 Share Posted February 4, 2010 (edited) There shouldn't be a problem if the dialogs have the same class name since you are using titles to match them. The only scenario I can think of now is that you are using the wrong title to match the dialog. Try reviewing whether the titles are correct, using the Window Info Tool. you could also try putting this at the top of your script to make your title matching return true on partial matches. Opt("WinTitleMatchMode", 2) Edited February 4, 2010 by omikron48 Link to comment Share on other sites More sharing options...
jinyue115 Posted February 4, 2010 Share Posted February 4, 2010 WinWaitActive("Dialog 1") ControlCommand("Dialog 1","",225,"SelectString","string") WinWait("Dialog 2") WinActivate("Dialog 2") sleep(5000) $st = ControlSetText("Dialog 2", "", 7000, "11" ) MsgBox(1,"test",$st) Link to comment Share on other sites More sharing options...
Jaw7 Posted February 4, 2010 Author Share Posted February 4, 2010 @omikron48 Thanks for your method but it still doesn't work. I'm sure I wrote the right title of Dialog 2, because when I trigger it manually, it could be found. So partial match can't solve my problem. @jinyue115 The script stucked at WinWait("Dialog 2"), not ControlSetText. So I believe this won't work either. @herewasplato I will try to find some pixel functions. Thank you for your help! 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