Random text display from array

Get help with using AutoHotkey (v1.1 and older) 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: 1112
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
ScriptGuard - Protects Compiled Scripts from Decompilation
I also maintain Ahk2Exe
bordop
Posts: 10
Joined: 03 Jun 2018, 23:03
Contact:

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 (v1)”

Who is online

Users browsing this forum: ArkuS, Chunjee, Google [Bot], WAZAAAAA and 382 guests