Skip to content

Instantly share code, notes, and snippets.

@JoeGlines
Created November 5, 2022 13:01
Show Gist options
  • Save JoeGlines/2e296d78d38f178690b309319c476efc to your computer and use it in GitHub Desktop.
Save JoeGlines/2e296d78d38f178690b309319c476efc to your computer and use it in GitHub Desktop.
;*******************************************************
; Want a clear path for learning AutoHotkey; Take a look at our AutoHotkey courses.
;They're structured in a way to make learning AHK EASY: https://the-Automator.com/Learn
;*******************************************************
#Include <default_Settings>
;**************************************
/*
Tick:=A_TickCount
FileRead,Text,%A_AhkPath%\..\License.txt
m(A_TickCount-Tick)
*/
;~ FileName:="I:\Users\maest_mcwl8s3\Dropbox\Joe\baby-names2.csv"
FileName:="C:\Users\Joe\DropBox\Progs\AutoHotkey_L\AHK Work\Gender-names\baby-names2.csv"
Tick:=A_TickCount
SetBatchLines,-1
if(){
Obj1:=[],aa:=0
Loop,Read,%FileName%
{
aa++ ;increment rows- Need to know what the last row is
/*
Text.=A_LoopReadLine "`r`n"
Obj1.Push(A_LoopReadLine)
*/
}
Random,Random,1,%aa%
FileReadLine,Text,%FileName%,%Random%
m(A_TickCount-Tick)
ExitApp
}else if(){
FileRead,Text,%FileName%
}else{
File:=FileOpen(FileName,"R","UTF-8"),Text:=File.Read(),File.Close()
Random,Random,1,% (Obj:=StrSplit(Text,"`n","`r`n")).MaxIndex()
m(A_TickCount-Tick,Trim(Obj[Random],"`t"),Obj.MaxIndex())
}
if(){
Random,Random,1,% Obj1.MaxIndex()
m(Trim(Obj1[Random],"`t"))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment