Sign in to follow this  
Followers 0
onestcoder

Function Loop

5 posts in this topic

How can I loop this in a function

Func _Startwait()
 GUICtrlSetData($statusoutput, 'Wait.')
 Sleep(500)
 GUICtrlSetData($statusoutput, 'Wait..')
 Sleep(500)
 GUICtrlSetData($statusoutput, 'Wait...')
 Sleep(500)
 GUICtrlSetData($statusoutput, 'Wait....')
 Sleep(500)
 GUICtrlSetData($statusoutput, 'Wait.....')
 Sleep(500)
 GUICtrlSetData($statusoutput, 'Wait.')
 Sleep(500)
 GUICtrlSetData($statusoutput, 'Wait..')
 Sleep(500)
 GUICtrlSetData($statusoutput, 'Wait...')
 Sleep(500)
 GUICtrlSetData($statusoutput, 'Wait....')
 Sleep(500)
 GUICtrlSetData($statusoutput, 'Wait.....')
 Sleep(500)
EndFunc   ;==>_Startwait

Need a website: http://www.iconixmarketing.com

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

What about using a Do...Until loop? Do _StartWait Until...<whatever action>. (Then you'd only need the function to be half as long.)

Edited by GMK

Share this post


Link to post
Share on other sites

#include <Array.au3>
#include <GUIConstants.au3>
$Array = _ArrayCreate("",".","..","...","....",".....")
Dim $Array
GuiCreate("hi")
$statusoutput = GUICtrlCreateInput("",100,5,200,25)
$Click = GUICtrlCreateButton("Click",5,5)
GuiSetState()

While 1

     $msg = GUIGetMsg()
     if $msg = $click Then
         _Startwait()
    EndIf
Wend

Func _Startwait()
While 1
    For $i = 1 To 5
 GUICtrlSetData($statusoutput, $Array[$i])
 Sleep(500)
 next
Wend
EndFunc   ;==>_Startwait

It can be simpeler/faster i think :)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

You mean something like?

Func _Startwait()
    For $x = 1 To 2
        $dot = ""
        For $y = 1 To 5
            $dot &= "."
            GUICtrlSetData($statusoutput, 'Wait' & $dot)
            Sleep(500)
        Next
    Next
EndFunc   ;==>_Startwait
Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

Works great THANK YOU!!!


Need a website: http://www.iconixmarketing.com

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