there are thousands of lines, I would like to search for a word from the bottom up when I find the word
in the written file, inform me with a text box,
I would like to put a limit on him to search from the bottom up, just look at 50 lines if you don't find him stop looking.
I would be very grateful
Re: I would be very grateful
example with few lines for test
Code: Select all
aac=
(
Line1 This is a test
Line2 This is a test
Line3 This is a test
Line4 This is the test
Line5 This is a test
Line6 This is var test
Line7 This is a test
Line8 This is a test
Line9 This is a test
)
;x1:= "D:\Temp\MyScript.txt"
;fileread,aac,%x1% ;- read txt-file to memory
i1=0
i2=0
e:=""
Loop,parse,aac,`n,`r ;- parse each line by `n ascii-10 (EndOfLine ascii 13,10 )
{
x:= A_LoopField ;- line in variable aac
i1++
if (i1=8)
break ;- break here
if (( inStr(x, " the " ) || inStr(x, " var " )))
{
i2++
e .= i1 . "-" . x . "`r`n"
}
}
msgbox,Total lines=%i1%`nfound total %i2%-Lines=`n%e%
exitapp
Re: I would be very grateful
Code: Select all
~sc03F::
word01:=" " ;-search word here
FileRead, var, C:\Users\computer\Desktop\MyScript.log
arr := strsplit(var, "`n", "`r")
loop, % ln := arr.length() {
currln := arr[ln - a_index + 1]
if % instr(currln, word01) {
msgbox the word was found
Break
}
}
return
Re: I would be very grateful
Code: Select all
~sc03F::
word01 := " " ;-search word here
FileRead, var, C:\Users\computer\Desktop\MyScript.log
arr := strsplit(var, "`n", "`r")
loop, % ln := arr.length() {
currln := arr.Pop()
if (instr(currln, word01)) {
MsgBox % "The word " word01 " was found at line " Ln-A_Index+1
Break
}
if (A_Index > 50) {
break
}
}
return
____________________________________________________________________________
Windows 10 Pro 64 bit - Autohotkey v1.1.30.01 64-bit Unicode
Windows 10 Pro 64 bit - Autohotkey v1.1.30.01 64-bit Unicode