Jump to content

Simple While...WEnd


Recommended Posts

I created a script using while but it didnt work when it came to 2nd script.

$i = 0
$s = 0

Func Action()
    While $i <= 3
    Send("{f}")
    Sleep(1000)
    Send("{1}")
    Sleep(1000)
    Send("{7}")
    Sleep(100)
    Send("{x}")
    Sleep(100)
    $i = $i + 1
WEnd
    While $s = 1
    Send("{9}")
    Sleep(10000)
    $s = $s + 1
WEnd
EndFunc

I want my 1st script to repeat doing the same action for 3 times.

Then, the next script will running for 1 times.

Then, it will continue to repeat the 1st script back and so on.

Which part that i got it wrong?

Link to comment
Share on other sites

whatever Edited by MvGulik

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Link to comment
Share on other sites

Which part that i got it wrong?

$i = 0
$s = 0

Action() ; <-- fix

Func Action()
    While $i <= 3
    Send("{f}")
    Sleep(1000)
    Send("{1}")
    Sleep(1000)
    Send("{7}")
    Sleep(100)
    Send("{x}")
    Sleep(100)
    $i = $i + 1
WEnd
    While $s = 1
    Send("{9}")
    Sleep(10000)
    $s = $s + 1
WEnd
EndFunc

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

$i = 0
$s = 0

Func Action()
    While $i <= 3
    Send("{f}")
    Sleep(1000)
    Send("{1}")
    Sleep(1000)
    Send("{7}")
    Sleep(100)
    Send("{x}")
    Sleep(100)
    $i = $i + 1
WEnd
    While $s <=2
    Send("{9}")
    Sleep(10000)
    $s = $s + 1
WEnd
EndFunc

I've got it.

But right now, the script will End after the 2nd script been executed.

How to jump / repeat the 1st script back?

Or i have to keep copy and paste it?

Link to comment
Share on other sites

While 1
    $i = 0
    Action()
WEnd

Func Action()
    While $i <= 3
        Send("f")
        Sleep(1000)
        Send("1")
        Sleep(1000)
        Send("7")
        Sleep(100)
        Send("x")
        Sleep(100)
        $i = $i + 1
    WEnd
    Send("9")
    Sleep(10000)
EndFunc

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Link to comment
Share on other sites

whatever Edited by MvGulik

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...