Sign in to follow this  
Followers 0
Auto-It-Noob

while loop won't stop

12 posts in this topic

hi,

i created an auto-it loop and want to exit auto-it if the text end comes.

i tried this:

If WinExists("Editor","end") Then Exit

but the loop / auto-it doesn't exit and the loop continue all the time :P

can someone tell me my mistake please?

Share this post


Link to post
Share on other sites



hi,

i created an auto-it loop and want to exit auto-it if the text end comes.

i tried this:

but the loop / auto-it doesn't exit and the loop continue all the time :P

can someone tell me my mistake please?

more code would be necessary to see why your exit condition isn't being met. one tip, you probably want exitloop instead of exit..

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

I do not know if this helps

While 1
    Sleep(100)
If WinExists("Untitled -", "end") Then
    Exit
EndIf
WEnd


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

Opt("WinWaitDelay",0)
While 1
WinWait("Accounts - test.txt - Editor","")
If Not WinActive("Accounts - test.txt - Editor","") Then WinActivate("Accounts - test.txt - Editor","")
WinWaitActive("Accounts - test.txt - Editor","")
Send("{CTRLDOWN}f{CTRLUP}")
WinWait("Suchen","Groß-/Kleins&chreibu")
If Not WinActive("Suchen","Groß-/Kleins&chreibu") Then WinActivate("Suchen","Groß-/Kleins&chreibu")
WinWaitActive("Suchen","Groß-/Kleins&chreibu")
Send("url{SHIFTDOWN}.{SHIFTUP}{ALTDOWN}w{F4}{ALTUP}")
^
^
^
^
^
If WinExists("Editor", "end") Then Exitloop
^
^
^
^
^
WinWait("Accounts - test.txt - Editor","")
If Not WinActive("Accounts - test.txt - Editor","") Then WinActivate("Accounts - test.txt - Editor","")
WinWaitActive("Accounts - test.txt - Editor","")
Send("{RIGHT}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{CTRLDOWN}f{CTRLUP}")
WinWait("Suchen","Groß-/Kleins&chreibu")
If Not WinActive("Suchen","Groß-/Kleins&chreibu") Then WinActivate("Suchen","Groß-/Kleins&chreibu")
WinWaitActive("Suchen","Groß-/Kleins&chreibu")
Send("{SPACE}{SHIFTDOWN}4{SHIFTUP}{ALTDOWN}w{F4}{ALTUP}")
WinWait("Accounts - test.txt - Editor","")
If Not WinActive("Accounts - test.txt - Editor","") Then WinActivate("Accounts - test.txt - Editor","")
WinWaitActive("Accounts - test.txt - Editor","")
Send("{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{CTRLDOWN}f{CTRLUP}")
WinWait("Suchen","Groß-/Kleins&chreibu")
If Not WinActive("Suchen","Groß-/Kleins&chreibu") Then WinActivate("Suchen","Groß-/Kleins&chreibu")
WinWaitActive("Suchen","Groß-/Kleins&chreibu")
Send("ftp{SHIFTDOWN}.{SHIFTUP}{ALTDOWN}w{F4}{ALTUP}")
WinWait("Accounts - test.txt - Editor","")
If Not WinActive("Accounts - test.txt - Editor","") Then WinActivate("Accounts - test.txt - Editor","")
WinWaitActive("Accounts - test.txt - Editor","")
Send("{RIGHT}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{CTRLDOWN}f{CTRLUP}")
WinWait("Suchen","Groß-/Kleins&chreibu")
If Not WinActive("Suchen","Groß-/Kleins&chreibu") Then WinActivate("Suchen","Groß-/Kleins&chreibu")
WinWaitActive("Suchen","Groß-/Kleins&chreibu")
Send("{SPACE}{SHIFTDOWN}4{SHIFTUP}{ALTDOWN}w{F4}{ALTUP}")
WinWait("Accounts - test.txt - Editor","")
If Not WinActive("Accounts - test.txt - Editor","") Then WinActivate("Accounts - test.txt - Editor","")
WinWaitActive("Accounts - test.txt - Editor","")
Send("{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{

DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{SHIFTDOWN}{END}{SHIFTUP}{CTRLDOWN}x{CTRLUP}{CTRLDOWN}f{

CTRLUP}")
WinWait("Suchen","Groß-/Kleins&chreibu")
If Not WinActive("Suchen","Groß-/Kleins&chreibu") Then WinActivate("Suchen","Groß-/Kleins&chreibu")
WinWaitActive("Suchen","Groß-/Kleins&chreibu")
Send("ftp{SHIFTDOWN}.{SHIFTUP}{ALTDOWN}ow{F4}{ALTUP}")
WinWait("Accounts - test.txt - Editor","")
If Not WinActive("Accounts - test.txt - Editor","") Then WinActivate("Accounts - test.txt - Editor","")
WinWaitActive("Accounts - test.txt - Editor","")
Send("{RIGHT}{CTRLDOWN}v{CTRLUP}{CTRLDOWN}{ALTDOWN}q{CTRLUP}{ALTUP}{CTRLDOWN}f{CTRLUP}")
WinWait("Suchen","Groß-/Kleins&chreibu")
If Not WinActive("Suchen","Groß-/Kleins&chreibu") Then WinActivate("Suchen","Groß-/Kleins&chreibu")
WinWaitActive("Suchen","Groß-/Kleins&chreibu")
Send("username{SHIFTDOWN}.{SHIFTUP}{ALTDOWN}ow{F4}{ALTUP}")
WinWait("Accounts - test.txt - Editor","")
If Not WinActive("Accounts - test.txt - Editor","") Then WinActivate("Accounts - test.txt - Editor","")
WinWaitActive("Accounts - test.txt - Editor","")
Send("{RIGHT}{SHIFTDOWN}{END}{SHIFTUP}{CTRLDOWN}c{CTRLUP}{CTRLDOWN}f{CTRLUP}")
WinWait("Suchen","Groß-/Kleins&chreibu")
If Not WinActive("Suchen","Groß-/Kleins&chreibu") Then WinActivate("Suchen","Groß-/Kleins&chreibu")
WinWaitActive("Suchen","Groß-/Kleins&chreibu")
Send("ftp{SHIFTDOWN}.{SHIFTUP}{ALTDOWN}uw{F4}{ALTUP}")
WinWait("Accounts - test.txt - Editor","")
If Not WinActive("Accounts - test.txt - Editor","") Then WinActivate("Accounts - test.txt - Editor","")
WinWaitActive("Accounts - test.txt - Editor","")
Send("{RIGHT}ftp://{CTRLDOWN}v{CTRLUP}{SHIFTDOWN}.{SHIFTUP}")
WEnd

the code is crap..

but it works except the exitloop :P

While 1
    Sleep(100)
If WinExists("Untitled -", "end") Then
    Exit
EndIf
WEnd

i tried this, too.

but i got this error:

"EndIf" statement with no matching "If" statement.

Share this post


Link to post
Share on other sites

Opt("WinWaitDelay",0)
While 1
WinWait("Accounts - test.txt - Editor","")
If Not WinActive("Accounts - test.txt - Editor","") Then WinActivate("Accounts - test.txt - Editor","")
WinWaitActive("Accounts - test.txt - Editor","")
Send("{CTRLDOWN}f{CTRLUP}")
WinWait("Suchen","Groß-/Kleins&chreibu")
If Not WinActive("Suchen","Groß-/Kleins&chreibu") Then WinActivate("Suchen","Groß-/Kleins&chreibu")
WinWaitActive("Suchen","Groß-/Kleins&chreibu")
Send("url{SHIFTDOWN}.{SHIFTUP}{ALTDOWN}w{F4}{ALTUP}")
^
^
^
^
^
If WinExists("Editor", "end") Then Exitloop
^
^
^
^
^
WinWait("Accounts - test.txt - Editor","")
If Not WinActive("Accounts - test.txt - Editor","") Then WinActivate("Accounts - test.txt - Editor","")
WinWaitActive("Accounts - test.txt - Editor","")
Send("{RIGHT}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{CTRLDOWN}f{CTRLUP}")
WinWait("Suchen","Groß-/Kleins&chreibu")
If Not WinActive("Suchen","Groß-/Kleins&chreibu") Then WinActivate("Suchen","Groß-/Kleins&chreibu")
WinWaitActive("Suchen","Groß-/Kleins&chreibu")
Send("{SPACE}{SHIFTDOWN}4{SHIFTUP}{ALTDOWN}w{F4}{ALTUP}")
WinWait("Accounts - test.txt - Editor","")
If Not WinActive("Accounts - test.txt - Editor","") Then WinActivate("Accounts - test.txt - Editor","")
WinWaitActive("Accounts - test.txt - Editor","")
Send("{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{CTRLDOWN}f{CTRLUP}")
WinWait("Suchen","Groß-/Kleins&chreibu")
If Not WinActive("Suchen","Groß-/Kleins&chreibu") Then WinActivate("Suchen","Groß-/Kleins&chreibu")
WinWaitActive("Suchen","Groß-/Kleins&chreibu")
Send("ftp{SHIFTDOWN}.{SHIFTUP}{ALTDOWN}w{F4}{ALTUP}")
WinWait("Accounts - test.txt - Editor","")
If Not WinActive("Accounts - test.txt - Editor","") Then WinActivate("Accounts - test.txt - Editor","")
WinWaitActive("Accounts - test.txt - Editor","")
Send("{RIGHT}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{CTRLDOWN}f{CTRLUP}")
WinWait("Suchen","Groß-/Kleins&chreibu")
If Not WinActive("Suchen","Groß-/Kleins&chreibu") Then WinActivate("Suchen","Groß-/Kleins&chreibu")
WinWaitActive("Suchen","Groß-/Kleins&chreibu")
Send("{SPACE}{SHIFTDOWN}4{SHIFTUP}{ALTDOWN}w{F4}{ALTUP}")
WinWait("Accounts - test.txt - Editor","")
If Not WinActive("Accounts - test.txt - Editor","") Then WinActivate("Accounts - test.txt - Editor","")
WinWaitActive("Accounts - test.txt - Editor","")
Send("{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{

DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{DEL}{SHIFTDOWN}{END}{SHIFTUP}{CTRLDOWN}x{CTRLUP}{CTRLDOWN}f{

CTRLUP}")
WinWait("Suchen","Groß-/Kleins&chreibu")
If Not WinActive("Suchen","Groß-/Kleins&chreibu") Then WinActivate("Suchen","Groß-/Kleins&chreibu")
WinWaitActive("Suchen","Groß-/Kleins&chreibu")
Send("ftp{SHIFTDOWN}.{SHIFTUP}{ALTDOWN}ow{F4}{ALTUP}")
WinWait("Accounts - test.txt - Editor","")
If Not WinActive("Accounts - test.txt - Editor","") Then WinActivate("Accounts - test.txt - Editor","")
WinWaitActive("Accounts - test.txt - Editor","")
Send("{RIGHT}{CTRLDOWN}v{CTRLUP}{CTRLDOWN}{ALTDOWN}q{CTRLUP}{ALTUP}{CTRLDOWN}f{CTRLUP}")
WinWait("Suchen","Groß-/Kleins&chreibu")
If Not WinActive("Suchen","Groß-/Kleins&chreibu") Then WinActivate("Suchen","Groß-/Kleins&chreibu")
WinWaitActive("Suchen","Groß-/Kleins&chreibu")
Send("username{SHIFTDOWN}.{SHIFTUP}{ALTDOWN}ow{F4}{ALTUP}")
WinWait("Accounts - test.txt - Editor","")
If Not WinActive("Accounts - test.txt - Editor","") Then WinActivate("Accounts - test.txt - Editor","")
WinWaitActive("Accounts - test.txt - Editor","")
Send("{RIGHT}{SHIFTDOWN}{END}{SHIFTUP}{CTRLDOWN}c{CTRLUP}{CTRLDOWN}f{CTRLUP}")
WinWait("Suchen","Groß-/Kleins&chreibu")
If Not WinActive("Suchen","Groß-/Kleins&chreibu") Then WinActivate("Suchen","Groß-/Kleins&chreibu")
WinWaitActive("Suchen","Groß-/Kleins&chreibu")
Send("ftp{SHIFTDOWN}.{SHIFTUP}{ALTDOWN}uw{F4}{ALTUP}")
WinWait("Accounts - test.txt - Editor","")
If Not WinActive("Accounts - test.txt - Editor","") Then WinActivate("Accounts - test.txt - Editor","")
WinWaitActive("Accounts - test.txt - Editor","")
Send("{RIGHT}ftp://{CTRLDOWN}v{CTRLUP}{SHIFTDOWN}.{SHIFTUP}")
WEnd

the code is crap..

but it works except the exitloop :P

While 1
    Sleep(100)
If WinExists("Untitled -", "end") Then
    Exit
EndIf
WEnd

i tried this, too.

but i got this error:

try

While 1
    Sleep(100)
If WinExists("Untitled -", "end") Then ExitLoop
WEnd

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

it doesn't stop with:

While 1

Sleep(100)

If WinExists("Untitled -", "end") Then ExitLoop

WEnd

&

While 1

Sleep(100)

If WinExists("Editor", "end") Then ExitLoop

WEnd

Share this post


Link to post
Share on other sites

Just out of curiousity... Is "Editor" the title of the window that contains the 'word' "end" in it?


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

it doesn't stop with:

While 1

Sleep(100)

If WinExists("Untitled -", "end") Then ExitLoop

WEnd

&

While 1

Sleep(100)

If WinExists("Editor", "end") Then ExitLoop

WEnd

try:

While 1
    Sleep(100)
If WinExists("Untitled -", "") Then ExitLoop
WEnd

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

Just out of curiousity... Is "Editor" the title of the window that contains the 'word' "end" in it?

Posted Image

i think it's editor ^^

@cameronsdad

it doesn't work, too

Share this post


Link to post
Share on other sites

Maybe add something like

Opt("WinTitleMatchMode", 2) ;1=start, 2=subStr, 3=exact, 4=advanced

Share this post


Link to post
Share on other sites

Posted Image

i think it's editor ^^

@cameronsdad

it doesn't work, too

it doesn't work because the title is Editor not Untitled - change the string and it should work...

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

Mabey:

If WinExists("Editor", '"end"') Then ExitLoop

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