mardi 15 mars 2016

How can I have this script choose a random word from a list and output it without repeating the previous output in autohotkey?

I am trying to make a script that outputs a word and enters into chat without repeating the previous word. I am using autohotkey to do so. Here is my code.

Word1 = This
Word2 = Is
Word3 = A
Word4 = Test
Word5 = Script
Word6 = And
Word7 = I
Word8 = Like
Word9 = Apple
Word10 = Pie

Min := 1
Max := 10

MButton:: 
   RandWords := "" 
   Loop 1
   { 
      Random N, %Min%, %Max% 
      RandWords .= Word%N% 
   }
   Send %RandWords% {enter} 
Return

So basically, every time I press the middle button on the mouse, it will output a random word from the listed words above. But I am trying to avoid it doing,

Script
Script
Script

I don't mind if the program outputs,

Like
Apple
Like
Apple

So long as each output is different from the previous.




Aucun commentaire:

Enregistrer un commentaire