I encountered a blocking point while trying to extract a word (text) from a file.
Below is the text that is stored in the file:
- This is just some random text.
Write any text, but the text should be this long.
If text exist, than it' ok.
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#SingleInstance Force
Gui, Add, Text, x10 y12, Load file.
Gui, Add, Button, x10 y30 w90 h20 gloadfile, Open File
Gui, Show, w300 h300,TEST
return
GuiClose:
ExitApp
loadfile:
FileSelectFile, eFile, 3, , Open the file, Text Documents (*.txt; *.xml; *.html; *.csv)
fileread,contents,%eFile%
RegExReplace(contents,"\n","",totalLines) ;match the number of new line character
totalLines++ ;always 1 short
loop,parse,contents,`n
{
OutputVar := RegExMatch(A_LoopField, "(text)",var1)
MsgBox, %OutputVar% & %var1%
}
return
I know that the code does exactly what i tell him to do, it extracts line by line from file,and the first occurrence is stored in var1 and after that it continues the loop.
Any ideas how to make it to find all the words text?