Sign in to follow this  
Followers 0
Booo

help: Code random string

6 posts in this topic

can any one help me please i'm new in  autoit

my code please fix it

HotKeySet("{ESC}", "Terminate")
local asd = {
"{SPACE}",
"{W}",
"{D}",
"{A}",
"{S}",
}


While 1
Local $iRandom = Random(1, 5)

Send(asd[$iRandom])

WEnd

Func Terminate()

    Exit 0

EndFunc

Share this post


Link to post
Share on other sites



 

can any one help me please i'm new in  autoit

my code please fix it

Assume this is a language knowledge gap or else this is a little rude way of asking for help.

So, what is your problem?

What is it you can't get solved yourself?

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Assume this is a language knowledge gap or else this is a little rude way of asking for help.

So, what is your problem?

What is it you can't get solved yourself?

Jos

 

sorry my friend

but i'm bad in english

i see wiki

http://www.autoitscript.com/wiki/Arrays

and i fix it

thank u any way

HotKeySet("{ESC}", "Terminate")

Local $arr[4] = ["{W}", "{D}", "{A}","{S}"]

While 1
Local $iRandom = Random(0, 3)

Send($arr[$iRandom])

WEnd

Func Terminate()

    Exit 0

EndFunc

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Looks good to me, except the 3rd param on random:

HotKeySet("{ESC}", "Terminate")

Local $arr[4] = ["{W}", "{D}", "{A}","{S}"]

While 1
    ConsoleWrite($arr[Random(0, UBound($arr)-1, 1)] & @CRLF)
    Sleep(10)
WEnd

Func Terminate()
    Exit 0
EndFunc
Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

Use...

Local $iRandom = Random(0, 3, 1)

Or Random will return a float decimal, for example  1.24

 

thank u bro

i fix it

 

 

Looks good to me, except the 3rd param on random:

HotKeySet("{ESC}", "Terminate")

Local $arr[4] = ["{W}", "{D}", "{A}","{S}"]

While 1
    ConsoleWrite($arr[Random(0, UBound($arr)-1, 1)] & @CRLF)
    Sleep(10)
WEnd

Func Terminate()
    Exit 0
EndFunc

 

thank u

I like the function  UBound, 

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