Jump to content
Sign in to follow this  
phew

ExitLoop doesn't work

Recommended Posts

phew

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 :)

Share this post


Link to post
Share on other sites
MHz

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"?

:)

Share this post


Link to post
Share on other sites
phew

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?

Share this post


Link to post
Share on other sites
MHz

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.

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.