An AutoHotkey library for manipulating text files and strings with over 40 functions for line operations, search/replace, and formatting.
TF is an AutoHotkey library that provides over 40 functions for manipulating text files and string variables. It solves the problem of automating text processing tasks—like editing configuration files, cleaning data, or reformatting logs—within AHK scripts without relying on external tools. The library handles operations such as line insertion/deletion, search/replace, column management, and file splitting.
AutoHotkey scripters and developers who need to automate text file editing, data parsing, or string manipulation within their scripts. It's particularly useful for those working with logs, configuration files, or any structured text data.
Developers choose TF because it consolidates dozens of text manipulation tasks into a single, well-documented library, eliminating the need to write repetitive file I/O and parsing code. Its dual support for files and variables, along with flexible range selection, makes it more versatile than built-in AHK commands for complex text processing.
AutoHotkey library for Text files & Variables (strings)
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Most functions automatically detect and process both text files and string variables, eliminating the need for separate code paths. The README shows examples like TF_ReadLines working identically on a file path or a variable.
With over 40 functions covering line operations, search/replace, formatting, and file management, it consolidates common text tasks. The list includes everything from TF_RemoveBlankLines to TF_SplitFileByText, reducing boilerplate code.
By default, functions create copies instead of overwriting originals, and a 'backup' folder triggers automatic .BAK files. This aligns with the philosophy of preventing accidental data loss, as stated in the README.
The StartLine/EndLine syntax supports single lines, sections, increments, and negative values for processing from the end. The README details examples like ('5-13,45-51', 135) for multiple sections in one call.
The README explicitly warns that line-by-line processing is slower than bulk operations, making it inefficient for very large files or high-speed automation where performance is critical.
Some functions like TF_Count only work with variables, while TF_Merge only works with files, forcing developers to remember limitations and implement workarounds, as noted in the 'Notes' section.
TF relies on AHK's FileEncoding and admits encoding detection is not 100% accurate without BOM, which can cause issues with Unicode or mixed-encoding files, as discussed in the 'File encoding, codepage' section.
The ! prefix for overwriting files and the intricate StartLine syntax (e.g., '2+3' for increments) require careful reading to avoid errors, and the README includes a 'Common mistake(s)' section highlighting pitfalls.