I've tried the scripts from these threads but they don't seem to do what I'm trying to do
https://www.autohotkey.com/boards/viewtopic.php?f=6&t=576
https://www.autohotkey.com/boards/viewtopic.php?t=29213
I copied and tried the one below too but I don't really understand how to make it work properly. It looks the closest to my purpose but the word to search for would be defined at the moment by pasting it from my clipboard. I am on AHK V1.1...
Code: Select all
If !FileExist(file := A_ScriptDir "\testFile.txt") { ; I made sure the .txt file is in same folder as the script
MsgBox, 48, Error, File not found. Aborting.`n`n%file%
Return
} Else FileRead, ttext, %file%
If !WinExist(wTitle := "ahk_exe notepad.exe") {
Run, notepad.exe
WinWaitActive, %wTitle%,, 5
If ErrorLevel {
MsgBox, 48, Error, An error occurred while waiting for the window. Aborting.
Return
}
} Else WinActivate
Send % find(ttext, "website") "`t" find(ttext, "address") "{Enter}"
Return
find(ttext, key) {
RegExMatch(ttext, "i)" key ":\h*(\w+)", match)
Return match1
}