So I have this script that lets me pick and send a random word from a text file (picks up a random line number and sends the line's content, as the file has over 7000 lines I guess it's less cpu intensive).
I don't know how to make it so it never sends the same word (or same line then?) more than once, until the script is relaunched or the loop broken.
I'm also trying to make a variation of this script that only picks words starting or ending with specific letters. Though I'm a bit lost and don't really know where to start, would appreciate any help!
Code: Select all
ChooseWords:
Loop,
{
if (BreakLoop = 1)
break
txtfile := "codes.txt"
FileRead, coSubleng, %txtfile%
fileArray := StrSplit(coSubleng, "`n")
Loop, Read, %txtfile%
{
total_lines = %A_Index%
}
Random, Var, 1, %total_lines%
Loop, 1
{
Random, Var, 1, %total_lines%
Line := fileArray[Var]
{
Send, %Line%{Enter}
}
}
Sleep, 1000
}
BreakLoop = 0
return