Ok..... I tried again myself and made this, but it doesn't work; why!? it's meant to search every line and if it finds the words 'to be taken' in any line to tell me what line, but it doesn't....
the ahk code:
Code:
#z::
WinGetText, text, test.txt
line=1
retry:
Loop, PARSE, text, `n, `r
If (A_Index = %line%)
{
StringGetPos, match, %A_Index%, to be taken
If ErrorLevel
{
MsgBox, 0, Nope, It is not in line %line%
line+=1
goto, retry
}
Else
{
MsgBox, 0, yes, It is in line %line%
}
}
The Notepad document open at the same time contains (it's called test - Notepad)
Hello
GoodBye
two to be taken once a day
What is your name?
paracetomol
What is your job?
500mg
56 Tablet(s)
thanks