Ahoy good sirs.
I'm new to this, had lotsa fun stealing/gluing parts together and somehow it actually works as intended - but..
the most demanding part (below) is super slow reading from a 35 mb .txt
Feels like I've done something horribly wrong, any neat trick to read a few lines in reverse from a big .txt file - faster than 1 min on a ssd?
;read file backwards, print recent lines of interest
Searchstring := "@From"
numberofhits := 0
numberofhitswanted := 12
;count number of lines
FileRead, f1, logs/Client.txt
Lines := ErrorLevel + 1
FileReadLine, lastline, logs/Client.txt, %Lines%
if (Lines < 0)
Lines := Lines - 1
IfInString, lastline, %Searchstring%
messages =: %messages%`n%lastline%
if numberofhits = %numberofhitswanted%
numberofhits := numberofhits + 1
Gui, Add,Edit,ReadOnly, last line number %a_index%`n%messages%`n`nnumber of hits %numberofhits%
Get help with using AutoHotkey and its commands and hotkeys
3 posts • Page 1 of 1
Omg using FileReadLine on a 35 MB script. Update your script immediately. I've done a script below. Cheers.
Code: Select all
q:: FileRead, vText, % A_ScriptFullPath oArray := StrSplit(vText, "`n", "`r") ;MsgBox, % oArray.Length() Loop, % vCount := oArray.Length() MsgBox, % vCount " " oArray[vCount--] return
wow yea, that works almost instantly.
TYVM good sir
TYVM good sir
Who is online
Users browsing this forum: Google [Bot], kadhri and 126 guests