I wrote an AHK script which prompts for User Input through InputBox, navigates through a text file based on user input line by line and copy the output to clipboard.
Example:
If "4max" is given as UserInput, it should copy the output "sleep" to clipboard.
If "3ben" is given as UserInput, it should copy the output "jog" to clipboard.
Sample Text File :
max:eat:drink:sleep:play
jerry:eat:play:drink:jog
laura:drink:eat:sleep:play
ben:sleep:jog:eat:drink
Can someone please enhance the below script?
Also when I run the script with a blank Notepad open, it is pasting the current item in Clipboard to notepad. :(.
Script:
#SingleInstance, force
#Include C:\Users\mpechett\Desktop\ahk\tf.ahk
InputBox, SearchText, Search for Name
x = %SearchText%
RegExMatch(x, "(\d*)(\w*)", y)
SearchText:= % y2
ptext = % TF_Find("C:\Users\mpechett\Desktop\ahk\test.txt", "","", SearchText, 1, 1)
StringSplit, word_array, ptext, :, .
;msgBox % word_array%y1%
Clipboard = % word_array%y1%
Msgbox, %Clipboard%
Esc::ExitApp