Sign in to follow this  
Followers 0
akke92

Loops

17 posts in this topic

Hello everyone!

So im really new to this whole Autoit thing and i just started to learn it!

I have this unanswered question that i would like to see if anyone here could answer?

Im not 100% sure how to use the loop function "While" as the last time i tried it, it didn't work out very well!

So if anyone has the time to explain how to use it correctly then i would really appreciate that!

Thank you guys!

Cheers. :)

 

Share this post


Link to post
Share on other sites



Why not post what you've tried? It's a lot easier to explain when we can see what you're shooting for.

Share this post


Link to post
Share on other sites

Why not post what you've tried? It's a lot easier to explain when we can see what you're shooting for.

Last time i did the owner removed the thread and told me to read rules.. Should i try again?

Share this post


Link to post
Share on other sites

akke92,

 

Should i try again?

Given what happened last time, I would strongly suggest not. And if you read the rules to which I linked you then know why. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

akke92,

 

Given what happened last time, I would strongly suggest not. And if you read the rules to which I linked you then know why. ;)

M23

Hehe, thats what i thought! i've read the rules but im unclear on which point you mean i do wrong, it could be that "i ask for help with a autoit script" but i've seen others done that alot on this forum! or it could be "Running or injecting any code (in any form) intended to alter the original functionality of another process" but im not sure, do you think i could post the code again if i remove the top part and just send the code starting from the "While 1" appeared in the code? ;)

Edited by akke92

Share this post


Link to post
Share on other sites

It seems you were trying to automate a game. You definitely should not post about it again.

As it says in the Forum Rules, you're not supposed to ask about that here for many reasons, among them being that it is often a violation of the Terms of Service of many applications, and also because encouraging it generally attracts unsavory clientele to the forum.

It's a shame you didn't read the rule before posting.

Share this post


Link to post
Share on other sites

akke92,

Your earlier thread was locked, as I explained when I did so, because it involved automating a game server - as that is pops up when I Google "Extalia". Limiting your question to understanding While loops I am just about prepared to accept - but not if you make it too obviously linked. ;)

M23

1 person likes this

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Yep, that was really immature of me. What If i remove everything that leads to automation of the game? Would you mind helping me then? please! :)

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Well here's a While Loops crash course:
 

;While Loop Structure
While {Expression}

    ;.
    ; Do actions
    ;. 

WEnd

While loops are used to repeat a block of code several times based on a expression.

Expression are conditions that evaluate to Boolean values (True/False)

As long as the condition at the top of the loop evaluates to True, everything inside it (between it and the WEnd keyword) will be continuously executed.

Hope that helps :D
 
You can read more about it Here at the Autoit Helpfile!

Edited by Paulie

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Well here's a While Loops crash course:

 

;While Loop Structure
While {Condition}

    ;.
    ; Do actions
    ;. 

WEnd
While loops are used to repeat a block of code several times based on a condition.

Conditions are expressions that evaluate to Boolean values (True/False)

As long as the condition at the top of the loop evaluates to True, everything inside it (between it and the WEnd keyword) will be continuously executed.

Hope that helps :D

 

It doesn't really help me... :( As i've tried following code already and it only loops maximum two times it really seems not to be working? maybe it's a bug or something with the current AutoIT version i have on my computer? but im supposed to have the latest? if i understand what you said you mean that it should be like i wrote right? but it doesn't work?... :(

or have i made it wrong?

while 1
Send("{HOME}")
Sleep(52000)
WEnd
Edited by akke92

Share this post


Link to post
Share on other sites

 

It doesn't really help me... :( As i've tried following code already and it only loops maximum two times it really seems not to be working? maybe it's a bug or something with the current AutoIT version i have on my computer? but im supposed to have the latest? if i understand what you said you mean that it should be like i wrote right? but it doesn't work?... :(

or have i made it wrong?

while 1
Send("{HOME}")
Sleep(52000)
WEnd

Well you do have it set to wait for 52 seconds in between each keypress... perhaps you aren't waiting long enough?

Share this post


Link to post
Share on other sites

Well you do have it set to wait for 52 seconds in between each keypress... perhaps you aren't waiting long enough?

Thats not it, im waiting long enough! I've tried waiting 3 minutes but it just stops there?

Is it maybe a to long delay/sleep? Maybe it's having a hard time counting that much? 

i have a other script, which looks like this that works just fine? on that one, im using while 1=1 though but i've tried that on the other script aswell and that didn't fix it? :(

while 1 = 1
Send("{LEFT down}")
Sleep(5000)
Send("{LEFT up}")
Send("{RIGHT down}")
Sleep(6000)
Send("{RIGHT up}")
Send("{LEFT down}")
Sleep(4710)
Send("{LEFT up}")
Send("{UP}")
Send("{UP}")
Send("{UP}")
Send("{UP}")
Send("{UP}")
Send("{UP}")
Send("{UP}")
Send("{UP}")
Send("{UP}")
Send("{UP}")
Send("{UP}")
Send("{UP}")
Sleep(1000)
Wend

Share this post


Link to post
Share on other sites

Yep, that was really immature of me. What If i remove everything that leads to automation of the game? Would you mind helping me then? please! :)

I think no one will help you, it too obvious... :whisper: :whisper: :whisper:


ill get to that... i still need to learn and understand a lot of codes graduated.gif

Correct answer, learn to walk before you take on that marathon.

Share this post


Link to post
Share on other sites

I think no one will help you, it too obvious... :whisper: :whisper: :whisper:

Yep i guess you're right.... :(

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

while 1
Send("{HOME}")
Sleep(52000)
WEnd
Try this to see that loop is working fine

while 1
Consolewrite("{HOME}" & @CRLF)
Sleep(1000)
WEnd
Edited by Zedna

Share this post


Link to post
Share on other sites

Works perfectly fine for me.

The below demonstrates it.

ShellExecute("http://www.autoitscript.com/forum/topic/165081-loops/")

While 1
    Sleep(2000)
    MouseWheel("down", 10)
    Sleep(2000)
    Send("{HOME}")
WEnd

Probably the game blocking it, and that's what you won't get help with.


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

Works perfectly fine for me.

The below demonstrates it.

ShellExecute("http://www.autoitscript.com/forum/topic/165081-loops/")

While 1
    Sleep(2000)
    MouseWheel("down", 10)
    Sleep(2000)
    Send("{HOME}")
WEnd

Probably the game blocking it, and that's what you won't get help with.

Yep, i think you're right! probably the game that blocks it, and thats why i wont ask for anymore help!

But thanks to everyone who tried to help me!

Cheers.

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