Random text display from array

Get help with using AutoHotkey and its commands and hotkeys
NAN
Posts: 1
Joined: 13 Sep 2018, 16:47

Random text display from array

13 Sep 2018, 17:55

Whats wrong with the below?

Code: Select all

!h::

Random, rand, 1, 3

a := {1:"Hi",2:"Hello",3:"Howdy"}

msg := a[%rand%]

send %msg%

return
TAC109
Posts: 580
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: Random text display from array

13 Sep 2018, 18:10

msg := a[%rand%] should be msg := a[rand]
My scripts:-
XRef - Produces Cross Reference lists for scripts
ReClip - A Text Reformatting and Clip Management utility
bordop
Posts: 10
Joined: 03 Jun 2018, 23:03
GitHub: bordop

Re: Random text display from array

13 Sep 2018, 18:14

this way works:

Code: Select all

F1::

option1 = "hi"
option2 = "yo"
option3 = "sup?"
Random, rn, 1, 3

msgbox % option%rn%
Return
F12::ExitApp

Return to “Ask For Help”

Who is online

Users browsing this forum: ader5429, Albireo, boiler, Google [Bot], Visioneer and 45 guests