TF_ColGet and TF_ColPut accept negative StartColumn parameter.A Negative startline value makes a TF function operate on the last X lines.("5 15") start with line 5, increment 15 until end of file so 5,20,35 etc.Incremental (EndLine will not be ignored) in the following cases: ("5-13,45-51", 135) Multiple sections of lines: 5 to 13, 45 to 51 ignore 135 ("StartLine", Endline - EndLine value is ignored).(5, 15) Section: lines 5 to 15 (StartLine, EndLine).(5) start from line 5 to the end (StartLine).You can pass on multiple lines (sections) by using the StartLine parameter. You can find examples of most functions in the "example script" here.Backup files: If a subdirectory "backup" is present in the directory of TextFileĪ backup is made before overwriting the original file (both for file.txt and file_copy.txt).Many functions also have specific parameters, see the description of each function below.Text to Replace (Find / Replace functions) Note: If Text is a variable, it can start with a ! as TF will detect automatically that it is not a file and will therefore not create a file but return the altered variable instead. "Filename.txt", see the examples in the AHK thread. Tip: you can use concatenation to add the !, e.g. If Text starts with ! (eg: "!c:\sample.txt") it will overwrite the text file, otherwise it will save the new file to a copy of the text file eg: Filename_copy.txt (All functions, apart from reading functions because there is no output file) the source file)Īs of v3 "Text" can also be a variable or indeed text directly passed on to the function. Note: by default a filename_copy will be created, use the ! prefix if you want to OverWrite the TextFile (e.g. The Filename (may include (absolute) path) to read from and save to (for all functions that write an output file). Quick intro to ParametersĪlmost all functions accept the following basic parameters: Parameter Large files/variables in case speed is an issue. Keep this in mind if you need to process many files/variables or very Slower compared to a function or script which could operate on an entire file or Note: Because most of these functions operate on a line by line basis they WILL be You can find examples of most functions in the "example script" here You can either place TF.ahk in your LIB directory (see ) (The result of these functions are simply a best guess assuming UTF-8 more common when BOM. See the discussion about this topic and possibly useful additional functions Please note, there is no way to determine the file encoding 100% accurately, even if a fileĬontains BOM. If you experience TF is changing the file encoding (codepage) try to set the correct file encodingĪt the top of your script (or at least before you call a TF function) using the following AutoHotkey command: To understand how to work with files and variables please read the "Textfile and the ! Prefix" (This is done in the helper function TF_GetData for those interested).
0 Comments
Leave a Reply. |