Extract line number from clipboard / text file.
Posted: 15 Jan 2018, 06:11
Morning All,
I'm trying to extract the line number from an auto generated text file to determine quantity of items (ie if string is on line 9 this means there is one number, if string is on line 11 this means there is 3 number).
I looked through the forums and found something similar on the archived forums:
https://autohotkey.com/board/topic/1006 ... le-please/
Below is how I have tried to implement it:
Odd thing is it returns 15 regardless of what text file I look at (be in just an 'a' or a full text document). I use it by making the notepad window active and hitting F11.
I'm trying to extract the line number from an auto generated text file to determine quantity of items (ie if string is on line 9 this means there is one number, if string is on line 11 this means there is 3 number).
I looked through the forums and found something similar on the archived forums:
https://autohotkey.com/board/topic/1006 ... le-please/
Below is how I have tried to implement it:
Code: Select all
F11::
Send ^a
Send ^c
string := "Subtotal"
Loop, Parse, clipboard, `r`n
{
If A_loopfield contains %string%
{
LineNum := A_Index
break
}
}
MsgBox %LineNum%
return