Jump to content
Sign in to follow this  
Auto-It-Noob

while loop won't stop

Recommended Posts

Auto-It-Noob

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
seandisanti

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..

Share this post


Link to post
Share on other sites
BigDod

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
Auto-It-Noob

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
seandisanti

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

Share this post


Link to post
Share on other sites
Auto-It-Noob

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
SmOke_N

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


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.

Share this post


Link to post
Share on other sites
seandisanti

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

Share this post


Link to post
Share on other sites
Auto-It-Noob

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
grakker

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
seandisanti

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...

Share this post


Link to post
Share on other sites
gamerman2360

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  

×

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.