Code: Select all
Random, var, 1, 100
FileAppend, %var%`n, test.txt
Code: Select all
Random, var, 1, 100
FileAppend, %var%`n, test.txt
Code: Select all
F10::
FileRead, content, my.txt
Random, var, 1, 100
If InStr(content,var)
MsgBox % "Meh, " var " already exists!"
Else
FileAppend,% var "`n", my.txt
Return
Code: Select all
q:: ;append random numbers to list, notify of duplicates
oArray := {}
Loop, 100
{
Random, var, 1, 100
if oArray.HasKey(var)
{
oArray[var]++
MsgBox, % var " has appeared " oArray[var] " times"
}
else
oArray[var] := 1
FileAppend, % var "`r`n", %A_Desktop%\z rand num.txt
Sleep, 100
}
MsgBox, % "done"
return
;==================================================
w:: ;recreate the array from the text file
FileRead, vText, %A_Desktop%\z rand num.txt
oArray := {}
Loop, Parse, vText, `n, `r
{
vTemp := A_LoopField
if (vTemp = "")
continue
else if oArray.HasKey(vTemp)
oArray[vTemp]++
else
oArray[vTemp] := 1
}
vOutput := ""
for vKey, vValue in oArray
vOutput .= vKey "`t" vValue "`r`n"
Clipboard := vOutput
return
You're damn rightteadrinker wrote:Hi, BoBo,
Consider: 1 and 11, 2 and 22 and so on.
Users browsing this forum: Google [Bot], Noitalommi_2 and 310 guests