phew Posted August 28, 2007 Share Posted August 28, 2007 hi, i got a problem with following code: While (1) $bla = WinGetTitle("misc") Select Case $bla = 0 ContinueCase Case $bla <> 0 Sleep(50) ControlSend($bla, "", "Edit1", "www.test.de {enter}") ExitLoop EndSelect WEnd i'm waiting for $bla becoming the string "misc" (waiting for opening C:\misc folder) then he should send the controlsend stuff.. i tried that with an if but actually it didn't either execute the if (tried with msgbox(0, "", "if executed") so i switched over to "select case.." sometimes i can start the script and all but the "ExitLoop" works fine, so it's sending the url 1000000x to the window. and now (without changing anything) i start the script and it's exiting immediately.. already tried $bla = "misc" instead of $bla <> 0 didn't success either! any suggestions? i'm sure it's a stupid mistake of mine caus im new to autoit Link to comment Share on other sites More sharing options...
MHz Posted August 28, 2007 Share Posted August 28, 2007 ContinueCase executes the conditions in the next Case statement so all the Case conditions will execute each time $bla = 0. Perhaps a value of a string = 0. You may want to use ContinueLoop instead of ContinueCase to keep the loop going? WinGetTitle() returns a string title so you should be checking $bla against the string "misc"? Link to comment Share on other sites More sharing options...
weaponx Posted August 28, 2007 Share Posted August 28, 2007 Opt("WinTitleMatchMode", 1) Do Sleep(100) Until ControlSend("misc", "", "Edit1", "www.test.de {enter}") Link to comment Share on other sites More sharing options...
phew Posted August 28, 2007 Author Share Posted August 28, 2007 yeah thanks i found it out myself half a minute ago, i changed it to: AutoItSetOption("SendKeyDelay", 0) While (1) $bla = WinGetTitle("misc") MsgBox(0, "", $bla) Select Case $bla = 0 ContinueLoop Case $bla = "misc" ControlSend($bla, "", "Edit1", "www.test.de {enter}") ExitLoop EndSelect WEnd so the msgbox views the string "misc" when i open the C:\misc folder, but actually it didn't send the ControlSend(...) stuff - why? Link to comment Share on other sites More sharing options...
narayanjr Posted August 28, 2007 Share Posted August 28, 2007 Opt("WinTitleMatchMode",2) While WinGetTitle("misc") = 0 Sleep(500) WEnd ControlSend(WinGetTitle("misc"), "", "Edit1", "www.test.de {enter}") Exit That should work also Link to comment Share on other sites More sharing options...
MHz Posted August 28, 2007 Share Posted August 28, 2007 so the msgbox views the string "misc" when i open the C:\misc folder, but actually it didn't send the ControlSend(...) stuff - why?A string value may always = 0 so your loop will never reach the 2nd Case statement. Link to comment Share on other sites More sharing options...
phew Posted August 28, 2007 Author Share Posted August 28, 2007 okay, thank you i'll fix that 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