Its pretty straight forward.
You can either use #include or use the LIB folder:
1. You can either use #include path-to-your-copy-of\tf.ahk
* in your script
* if you have your script and tf.ahk in the same folder #include tf.ahk
will work of course
2. Place a copy of tf.ahk
in one of the following folders on your computer:
%A_ScriptDir%\Lib\ ; Local library - requires [v1.0.90+].
%A_MyDocuments%\AutoHotkey\Lib\ ; User library.
Source & More info https://autohotkey.com/docs/Functions.htm#include
Working sample script
Code: Select all
01 AutoHotkey is a free, open-source utility for Windows. With it, you can:
02 - Automate almost anything by sending keystrokes and mouse clicks.
03 - Create hotkeys for keyboard, joystick, and mouse. Virtually any key, button, or combination can become a hotkey.
04 - Expand abbreviations as you type them. For example, typing "btw" can automatically produce "by the way".
05 - Create custom data-entry forms, user interfaces, and menu bars. See GUI for details.
06 - Remap keys and buttons on your keyboard, joystick, and mouse.
07 - Respond to signals from hand-held remote controls via the WinLIRC client script.
08 - Convert any script into an EXE file that can be run on computers that don't have AutoHotkey installed.
; TF_Find(FilePath, "", "", "i)\Q" SearchText "\E")
MsgBox % TF_Find("tftestfile123.txt", "", "", "abbreviations") ; remember it is case sensitive by default
MsgBox % TF_Find("tftestfile123.txt", "", "", "and",0) ; return a CSV list of all lines with 'and'
MsgBox % TF_Find("tftestfile123.txt", "5", "", "AutoHotkey") ; start at line 5 so it skips the first result e.g. line 1 here
myvar:="autohotkey" ; lowercase
MsgBox % TF_Find("tftestfile123.txt", "", "", "i)\Q" myvar "\E",0,1) ; return the text of all found lines