Sign in to follow this  
Followers 0
mrsyok

Simple While...WEnd

9 posts in this topic

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?

Share this post


Link to post
Share on other sites



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

Which part that i got it wrong?

Second while is never used because of $s is not 1 is declared as 0 so it never reaches your second while.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

so, can somebody show me the correct script base on mine?

Share this post


Link to post
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?

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

snowmaker : you are the best bro.. thanks.. :(

MvGulik : thank u so much for the idea.. :)

problem solved, have a nice day. :)

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