Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

TF: Text file & Variables/String Library v3.4 [lib]


  • Please log in to reply
244 replies to this topic
SoLong&Thx4AllTheFish
  • Members
  • 4999 posts
  • Last active:
  • Joined: 27 May 2007
This function can convert a delimited file to fixed columns (like in UltraEdit, will be only CSV like function in TF)

It is alpha code, proof of concept, works for LEFT and RIGHT alignment, center might give problems. Does work with properly formatted D/CSV files (thanks to Rhys & DerRaphael)

before
1,1234,56
12,234,56
112,345,6
after
1  ,1234,56
12 ,234 ,56
112,345 ,6
this way you can use a text-editor with column mode or the TF_Col* functions


Comments welcome, will probably release an updated TF early 2011 :wink:

file=
(
"John ""Da Man""",Repici,120 Jefferson St.,Riverside, NJ,08075
John,Doe,120 jefferson st.,Riverside, NJ, 08075
Jack,McGinnis,220 hobo Av.,Phila, PA,09119
Stephen,Tyler,"7452 Terrace ""At the Plaza"" road",SomeTown,SD, 91234
,Blankman,,SomeTown, SD, 00298
"Joan ""the bone"", Anne",Jet,"9th, at Terrace plc",Desert City,CO,00123
)
FileDelete, TestFile.csv
FileAppend, %file%,TestFile.csv

_TF_ConvertToFixedColumn("TestFile.csv", ",", 0) ; will create TestFile_copy.csv

_TF_ConvertToFixedColumn(Text, Delimiter = "," , Alignment = 0) 
	{
	; Alignment = 0 Left
	; Alignment = 1 Center
	; Alignment = 2 Right
	Trim:=A_AutoTrim
	AutoTrim, on
	TF_GetData(OW, Text, FileName)
	StringReplace, Text, Text, %A_Tab%, %A_Space%, All ; replace all tabs with spaces just to be sure
	Loop, Parse, Text, `n, `r
		{
		 If (A_LoopField = "")
			Continue
		 Col:=ReturnDSVArray(A_LoopField, "CSV_Row" . A_Index . "_Col", Delimiter)
	 	 Row:=A_Index
		}
	Loop, % Row
		{
		 ReadRow:=A_Index
		 Loop, % Col
		   {
		    Data:=CSV_Row%ReadRow%_Col%A_Index%
		    Data=%Data% ; autotrim
		    Data:=Format4CSV(Data)
		    Len:=StrLen(Data)
		    If TF_Count(Data,Chr(34)) > 2 ; if Data has " in it substract 2
			Len -= 2
		    If (Len > Longest)
			Longest:=Len
		   }	
		}
	Loop, % Row
		{
		 ReadRow:=A_Index
		 Loop, % Col
		 	{
			 Width:=Longest
			 Read:=CSV_Row%ReadRow%_Col%A_Index%
			 Read=%Read% ; autotrim
			 Quotes=
			 Quotes:=TF_Count(Read,Chr(34))
			 If (Quotes > 0)
				Width-=2*Quotes
			 Quotes:=TF_Count(Read,Delimiter)
			 If (Quotes > 0)
				Width-=2*Quotes
		    	 Read:=SetWidth(Read, Width, Alignment)
			 Read:=Format4CSV(Read)
			 If (StrLen(Read) < Longest)
				Loop, % Longest - StrLen(Read)
					Read .= A_Space
			    Output .= Read . Delimiter
		   	   }
	 	 StringTrimRight, Output, Output, 1 ; trim trailing	Delimiter
	 	 Output .= "`n"
    		}
	StringTrimRight, Output, Output, 1 ; trim trailing new line
 	Return TF_ReturnOutPut(OW, OutPut, FileName, TrimTrailing, CreateNewFile) 
	}


; SKAN
; http://www.autohotkey.com/forum/viewtopic.php?p=45880#45880
; SetWidth() : SetWidth increases a String's length by adding spaces to it and aligns it Left/Center/Right. ( Requires Space() ) 

SetWidth(Str,Width,AlignText) ; SKAN
	{
	 If (AlignText!=0 and AlignText!=1 and AlignText!=2)
		AlignText=0
	 If AlignText=0         
		{
		 RetStr= % (Str)Space(Width)
		 StringLeft, RetStr, RetStr, %Width%
		}
	 If AlignText=1         
		{
		 Spaces:=(Width-(StrLen(Str)))
		 RetStr= % Space(Round(Spaces/2))(Str)Space(Spaces-(Round(Spaces/2)))
		}
	 If AlignText=2         
		{
		 RetStr= % Space(Width)(Str)
		 StringRight, RetStr, RetStr, %Width%
		}
	 Return RetStr
	}

; SKAN
; http://www.autohotkey.com/forum/viewtopic.php?p=45880#45880

Space(Width) ; SKAN
	{
	 Loop,%Width%
	 Space=% Space Chr(32)
	 Return Space
	}

;###
; Delimiter Seperated Values by DerRaphael
; http://www.autohotkey.com/forum/post-203280.html#203280
;
; Proof of Concept to extract DSV (Delimiter Seperator Values)
;      - adapted for AHK by derRaphael / 21st July 2008 -
;                           [email protected]
; Following rules apply:
;   You have to set a delimiter char and an encapsulation char.
;   1) If you're using the delimeter char within your value, the value has
;      to be surrounded by your encapsulation char. One at beginning and one
;      at its end.
;   2) If you're using your encapsulation char within your value you have to
;      double it each time it occurs and surround your value as in rule 1.
; Remarks:
;   The whole concept will break, when using same EOL (End Of Line) as LineBreaks
;   in a value as in the entire file. Either you will have to escape these chars
;   somehow or use a single linefeed (`n) in values and carriage return linefeed
;   (`r`n) as EOL in your DSV file.
;   Encapsulation and delimiter chars have to be single Chars. Strings containing
;   more than one char are not supported by concept.
;CurrentDSVLine=a,b,c,"d,e","f"","",g",,i
;
;Loop, % ReturnDSVArray(CurrentDSVLine)
;   MsgBox % A_Index ": " DSVfield%A_Index%

ReturnDSVArray(CurrentDSVLine, ReturnArray="DSVfield", Delimiter=",", Encapsulator="""")
{
   global
   if ((StrLen(Delimiter)!=1)||(StrLen(Encapsulator)!=1))
   {
      return -1                            ; return -1 indicating an error ...
   }
   SetFormat,integer,H                      ; needed for escaping the RegExNeedle properly
   local d := SubStr(ASC(delimiter)+0,2)    ; used as hex notation in the RegExNeedle
   local e := SubStr(ASC(encapsulator)+0,2) ; used as hex notation in the RegExNeedle
   SetFormat,integer,D                      ; no need for Hex values anymore

   local p0 := 1                            ; Start of search at char p0 in DSV Line
   local fieldCount := 0                    ; start off with empty fields.
   CurrentDSVLine .= delimiter              ; Add delimiter, otherwise last field
   ;                                          won't get recognized
   Loop
   {
      Local RegExNeedle := "\" d "(?=(?:[^\" e "]*\" e "[^\" e "]*\" e ")*(?![^\" e "]*\" e "))"
      Local p1 := RegExMatch(CurrentDSVLine,RegExNeedle,tmp,p0)
      ; p1 contains now the position of our current delimitor in a 1-based index
      fieldCount++                         ; add count
      local field := SubStr(CurrentDSVLine,p0,p1-p0)
      ; This is the Line you'll have to change if you want different treatment
      ; otherwise your resulting fields from the DSV data Line will be stored in AHK array
      if (SubStr(field,1,1)=encapsulator)
      {
       ; This is the exception handling for removing any doubled encapsulators and
       ; leading/trailing encapsulator chars
       field := RegExReplace(field,"^\" e "|\" e "$")
       StringReplace,field,field,% encapsulator encapsulator,%encapsulator%, All
      }
      Local _field := ReturnArray A_Index  ; construct a reference for our ReturnArray name
      %_field% := field                    ; dereference _field and assign our value to it
      if (p1=0)
      {                          ; p1 is 0 when no more delimitor chars have been found
         fieldCount--                     ; so correct fieldCount due to last appended delimitor
         Break                            ; and exit loop
      } Else
         p0 := p1 + 1                     ; set the start of our RegEx Search to last result
   }                                        ; added by one
   return fieldCount
}

;###
; Format4CSV by Rhys
; http://www.autohotkey.com/forum/topic27233.html
Format4CSV(F4C_String)
{
   Reformat:=False ;Assume String is OK
   IfInString, F4C_String,`n ;Check for linefeeds
      Reformat:=True ;String must be bracketed by double quotes
   IfInString, F4C_String,`r ;Check for linefeeds
      Reformat:=True
   IfInString, F4C_String,`, ;Check for commas
      Reformat:=True
   IfInString, F4C_String, `" ;Check for double quotes
   {   Reformat:=True
      StringReplace, F4C_String, F4C_String, `",`"`", All ;The original double quotes need to be double double quotes
   }
   If (Reformat)
      F4C_String=`"%F4C_String%`" ;If needed, bracket the string in double quotes
   Return, F4C_String
}


Tuncay
  • Members
  • 1945 posts
  • Last active: Feb 08 2015 03:49 PM
  • Joined: 07 Nov 2006
Here is mine independent version:
#NoEnv 
SendMode Input 
SetWorkingDir %A_ScriptDir%

txt =
(
test, "long string", string
test2, string, longstring
test3, longstring, string
)

msgbox % new := convertToFixedColumn(txt)
clipboard := new   

convertToFixedColumn(_text, _delim="CSV", _minLen=1)
{
   Loop, Parse, _text, `n, `r
   {
      Col := A_Index
      Loop, PARSE, A_LoopField, %_delim%
      {
         line = %A_LoopField%
         Line_%Col%_%A_Index%_Data := line
         len := StrLen(line)
         If (len > longest)
         {
            Llongest := len + _minLen
         }
         Line_%Col%_%A_Index%_Len := len
      }
   }
   VarSetCapacity(new, _text)
   Loop, Parse, _text, `n, `r
   {
      Col := A_Index
      Loop, Parse, A_LoopField, %_delim%, %A_Space%
      {
         space := ""
         Loop, % longest - Line_%Col%_%A_Index%_Len
         {
            space .= " "
         }
         new .= A_LoopField . space
      }
      new .= "`n"
   }   
   return new
}
It converts from
test, "long string", string
test2, string, longstring
test3, longstring, string
to
test          "long string" string        
test2         string        longstring    
test3         longstring    string
And
1,1234,56
12,234,56
112,345,6
to
1    1234 56   
12   234  56   
112  345  6

Comma is replaced with longest word character space count.

No signature.


SoLong&Thx4AllTheFish
  • Members
  • 4999 posts
  • Last active:
  • Joined: 27 May 2007
@Tuncay: Try yours with a more complex CSV like the one in my example, it won't work (you need DRs helper function). One of the ideas I had was indeed to remove the delimiter or replace it with another one. But yours will be faster for "simpler" CSVs which may just be what someone needs.

For reference, Uberi posted a version as well <!-- m -->http://www.autohotke... ... 703#408703<!-- m --> which some may wish to study (I know Tuncay did as he copied the long string example)

Tuncay
  • Members
  • 1945 posts
  • Last active: Feb 08 2015 03:49 PM
  • Joined: 07 Nov 2006
Yes. I encountered many problems. This is an not so easy task, and my hat goes for you. Your version is more usable and more solid.

No signature.


peterm
  • Members
  • 60 posts
  • Last active: Jul 04 2013 05:24 PM
  • Joined: 25 Jul 2006
There is a function included in TF called TF_ColGet which appears to get individual characters rather than words.
e.g. to get column 1 to 2 from 123,345,567 gives 12
What I needed was a function to give the first and second word (or number) in the above example.
; A quick test of TF_ColGetWord in my TF.ahk
#include C:\Program Files\AutoHotkey\Lib\tf.ahk

Text2 = 
( 
1,2,3,4,5,6
10,11,12,13,14,15,16
20,21,22,23,24,25,26
30,31,32,34,35,36
)
; Extract Lines 1 and 2 and Numbers 3 to 6

Output := TF_ColGetWord(Text2,1,2,3,6,0)

msgbox %Output%
Return

; Get the specified Word from a Column in a set of lines.
; skip = 1, skip shorter lines (e.g. lines shorter startcolumn position)
TF_ColGetWord(Text, StartLine = 1, EndLine = 0, StartColumn = 1, EndColumn = 1, Skip = 0)
	{ 
	 TF_GetData(OW, Text, FileName)

	 TF_MatchList:=_MakeMatchList(Text, StartLine, EndLine) ; create MatchList

	 Loop, Parse, Text, `n, `r
		{
  	If A_Index in %TF_MatchList%
			{
  	 	If (Skip = 1) and (StrLen(A_LoopField) < StartColumn)
		        Continue
      Section := ""
      Loop, Parse, A_LoopField, `,
        {
        if ((A_Index >= StartColumn) and  (A_Index <= EndColumn))
          {
          if (Section = "")
            Section .= A_LoopField
          else
            Section .= "," A_LoopField            
          }
        }
       OutPut .= Section "`n"               
			}
		}
	 Return TF_ReturnOutPut(OW, OutPut, FileName)
}
I have based it on TF code so it could be incorporated if deemed acceptable.
A great set of functions for the manipulation of CSV files.
Well done HugoV. :D
Peterm

SoLong&Thx4AllTheFish
  • Members
  • 4999 posts
  • Last active:
  • Joined: 27 May 2007
@peterm:

For more robust CSV handling I would recommend this library

CSV Library [lib]
<!-- m -->http://www.autohotke...pic.php?t=55909<!-- m -->
Do note the bug fix here:
<!-- m -->http://www.autohotke... ... 669#400669<!-- m -->
(I've pm-ed Kdoske but he hasn't visited the forum in a while)

Lv2sfo
  • Members
  • 23 posts
  • Last active: Dec 19 2013 08:26 AM
  • Joined: 11 Jan 2010
I'm struggling to understand the syntax for using variables with these functions, could anybody advise?


For example

VarLine1 = 3
VarLine = 5

FileSelectFile, FileVar, , C:\Users\Name\Desktop, , Text Documents (*.txt; *.doc)

TF_RemoveLines("%FileVar%", %VarLine1%, %VarLine2%)


doesn't work.

I want to be able to create a loop to delete every other line from a file. I have a large dataset with more points than I require and I could do with trimming it down a little, it's causing my graphing software to hang :(

SoLong&Thx4AllTheFish
  • Members
  • 4999 posts
  • Last active:
  • Joined: 27 May 2007
First lets fix your example.
VarLine1 = 3
VarLine = 5
FileSelectFile, FileVar, , C:\Users\Name\Desktop, , Text Documents (*.txt; *.doc) ; don't use on DOC files as these are not TEXT files but binary files and will mess your files
TF_RemoveLines(FileVar, VarLine1, VarLine) ; this will create a copy, file_copy.txt with lines 3 4 and 5 removed
but as you want to replace every other line in your file

DeleteLines = 3+2 ; 3 5 7 9 11 13 etc
FileSelectFile, FileVar, , C:\Users\Name\Desktop, , Text Documents (*.txt)
TF_RemoveLines(FileVar, DeleteLines) ; will create a file_copy.txt with lines 3 5 7 9 11 13 etc removed
;TF_RemoveLines("!" . FileVar, DeleteLines) ; if you want to overwrite the source file use this

If you select multiple files with FileSelectFile you must do a bit more as shown in the example at <!-- m -->https://ahknet.autoh...ib.htm#TF_Merge<!-- m -->

DeleteLines = 3+2 ; 3 5 7 9 11 13 etc
; using FileSelectFile to select files to merged: (Thanks for asking Vitor, http://www.autohotkey.com/forum/viewtopic.php?p=335329#335329)
FileList=
FileSelectFile, FileList, M 1,,, *.txt ; M allows you to select multiple files while holding down the left ctrl button
If (ErrorLevel = 1) or (FileList = "")
   ExitApp ; no files selected
Path:=TF_ReadLines(FileList,1,1,1) ; the first line holds the directory of the selected files, so read path
FileList:=TF_RemoveLines(FileList,1,1) ; remove path from filelist
FileList:=TF_InsertPrefix(FileList, "", "", Path . "\") ; make sure all files have full paths to file so the are read correctly
Loop, FileList, `n, `r
	TF_RemoveLines(A_Loopfield, DeleteLines) ; if you want to overwrite the source file add "!" . before A_Loopfield


Lv2sfo
  • Members
  • 23 posts
  • Last active: Dec 19 2013 08:26 AM
  • Joined: 11 Jan 2010
Thankyou SO much.

This tool is incredible!!

I just couldn't get my head around it so thanks for the quick reply.

Takuya
  • Guests
  • Last active:
  • Joined: --
Hey guys,

the Library is really nice, but I couldn't solve this problem after hours of searching:

I want to replace the URL in a file with this line:


I tried various Regex expressions but it never worked cause I can't escape the " (quote) character.

How can I escape it? Or can it only be done with more complex Regex?

flak
  • Members
  • 283 posts
  • Last active: Jan 01 2012 06:20 PM
  • Joined: 02 Oct 2009
Quote is escaped with other quote.
"""" - literal quote.

Takuya
  • Guests
  • Last active:
  • Joined: --
Thanks a lot, solved my problem now :)

This replaces just the URL:
	TF_RegExReplace(EditCatalogXML,")(id=""call_url"" value="").*?("" />)", "$1" . CustomerURL . "$2")

It's quick and dirty, but I'm happy it works :)

SoLong&Thx4AllTheFish
  • Members
  • 4999 posts
  • Last active:
  • Joined: 27 May 2007
I'm working on an update of TF, adding one new function: TF_Join to join (specific) lines in a text file.

Feel free to test and post suggestions/bug reports. (testing requires a copy of TF in your lib or you have to #include it)

Other changes (not available yet):
[*:19i3yzmj] Added: TF_Join, join lines
[*:19i3yzmj] Fixed: TF_Find, TF_RegExReplace, TF_RegExReplaceInLines. More accurate RE check for these three functions to prevent false negatives. Hat tip to sinkfaze, see <!-- m -->http://www.autohotke...pic.php?t=60062<!-- m -->
[*:19i3yzmj] Changed: Negative startline operate on last X lines was already the case for TF_removelines, now applies to all TF functions
[*:19i3yzmj] Changed: TF_Substract: Partialmatch = 2 now deletes entiry line on partial match, see TF DOC for more info.
[*:19i3yzmj] Changed: TF_ColGet and TF_ColPut now accept negative StartColumn parameter. Can be used to Get or Put text in the xth "column" from the right, see DOC. TF_ColCut does not support this as you can use TF_TrimRight.
[*:19i3yzmj] Changed: TF_ColGet, TF_ColPut and TF_ColCut can now process multiple columns in one go. Format: CSV or incremental (please do NOT use sections for TF_ColPut)
var=
(join`r`n
|1 Automate almost anything by sending keystrokes and mouse clicks. You can write a mouse or keyboard macro by hand or use the macro recorder.%A_Space%
|2 Create hotkeys for keyboard, joystick, and mouse. Virtually any key, button, or combination can become a hotkey.
|3 Expand abbreviations as you type them. For example, typing "btw" can automatically produce "by the way".
|4 Create custom data-entry forms, user interfaces, and menu bars. See GUI for details%A_Space%
|5 Remap keys and buttons on your keyboard, joystick, and mouse.%A_Tab%
|6 Respond to signals from hand-held remote controls via the WinLIRC client script.
|7 Run existing AutoIt v2 scripts and enhance them with new capabilities.
|8 Convert any script into an EXE file that can be run on computers that don't have AutoHotkey installed.
)

MsgBox % TF_Join(var) ; join all lines, place a space between the lines
;MsgBox % TF_Join(var,"","",0,"-------") ; join all lines, insert ------ between the lines
;MsgBox % TF_Join(var,"","",0) ; join all lines, always insert CHAR between the lines
;MsgBox % TF_Join(var,"","",1) ; join all lines, only insert CHAR between the lines if it isn't already there
;MsgBox % TF_Join(var,"1,8","",1,"") ; will do nothing -> wrong start section [as test, "1-8" OK or "1-3,8-15" OK]
;MsgBox % TF_Join(var,"1+2") ; will do nothing -> wrong start section + not allowed
;MsgBox % TF_Join(var,1,5) ; join lines 1 to 5
;MsgBox % TF_Join(var,"1-3,6-7") ; join lines 1 to 3 and 6 & 7


; TF_Join by HugoV
; SmartJoin: Detect if CHAR is already present at the end of the line before joining the next, this to prevent unnecessary double spaces for example.
; Char: character(s) to use between new lines, defaults to a space
TF_Join(Text, StartLine = 1, EndLine = 0, SmartJoin = 0, Char = 0)
	{
	If ( (InStr(StartLine,",") > 0) AND (InStr(StartLine,"-") = 0) ) OR (InStr(StartLine,"+") > 0)
		Return Text ; can't do multiplelines, only multiple sections of lines e.g. "1,5" bad "1-5,15-10" good, "2+2" also bad
	TF_GetData(OW, Text, FileName)   
	If (InStr(Text,"`n") = 0)
		Return Text ; there are no lines to join so just return Text
	If (InStr(StartLine,"-") > 0)	; OK, we some counter-intuitive string mashing to substract ONE from the endline parameter
		{
		 Loop, Parse, StartLine, CSV
		 	{
		 	 StringSplit, part, A_LoopField, -
		 	 NewStartLine .= part1 "-" (part2-1) ","
		 	}
		 StringTrimRight, StartLine, NewStartLine, 1
		}		
	If (Endline > 0)
		Endline-- 
	TF_MatchList:=_MakeMatchList(Text, StartLine, EndLine)
	If (Char = 0)
		Char:=A_Space
	Char_Org:=Char
	GetRightLen:=StrLen(Char)-1
  Loop, Parse, Text, `n, `r
		{
		 If A_Index in %TF_MatchList%
			{
			 If (SmartJoin = 1)
				{
					GetRightText:=SubStr(A_LoopField,StrLen(A_LoopField)-GetRightLen)
					If (GetRightText = Char)
						Char=
				}
			 Output .= A_LoopField Char
			 Char:=Char_Org
			}
		 Else 
			Output .= A_LoopField "`n"
		}
	 Return TF_ReturnOutPut(OW, OutPut, FileName) 
	}


hoppfrosch
  • Members
  • 399 posts
  • Last active: Feb 26 2016 05:31 AM
  • Joined: 25 Jan 2006
Hi there,

just a little function, which I needed to do some file contents cleanup: TF_RemoveRegExLines(...)

It can be used to remove lines specified by regular expression: if the line matches the regular expression, the line will be removed ...

It's just a simple generalization of TF_RemoveBlankLines(...) , which uses a specialized RegEx to remove the blank lines.

Here it is:


var=
(join`r`n
|1 Automate almost anything by sending keystrokes and mouse clicks. You can write a mouse or keyboard macro by hand or use the macro recorder.%A_Space%
|2 Create hotkeys for keyboard, joystick, and mouse. Virtually any key, button, or combination can become a hotkey.
|3 Expand abbreviations as you type them. For example, typing "btw" can automatically produce "by the way".
|4 Create custom data-entry forms, user interfaces, and menu bars. See GUI for details%A_Space%
|5 Remap keys and buttons on your keyboard, joystick, and mouse.%A_Tab%
|6 Respond to signals from hand-held remote controls via the WinLIRC client script.
|7 Run existing AutoIt v2 scripts and enhance them with new capabilities.
|8 Convert any script into an EXE file that can be run on computers that don't have AutoHotkey installed.
)

MsgBox % TF_RemoveRegExLines(var, "Hotkey")
MsgBox % TF_RemoveRegExLines(var, "i)Hotkey")
MsgBox % TF_RemoveRegExLines(var, "i)\san[yd]\s")

TF_RemoveRegExLines(Text, NeedleRegEx = "", StartLine = 1, EndLine = 0)
	{
	 TF_GetData(OW, Text, FileName)
	 If (RegExMatch(Text, NeedleRegEx) < 1)
	 	Return Text
	 TF_MatchList:=_MakeMatchList(Text, StartLine, EndLine) ; create MatchList
	 Loop, Parse, Text, `n, `r
		{ 
		 If A_Index in %TF_MatchList%
         	 	OutPut .= (RegExMatch(A_LoopField,NeedleRegEx)) ? : A_LoopField "`n"
	         Else
        		OutPut .= A_LoopField "`n"
		}
	 Return TF_ReturnOutPut(OW, OutPut, FileName)
	}
_________________________
;     (.)~(.)   
;    (-------)                                    
;---ooO-----Ooo---------------------------------------------------
;    Hoppfrosch  - AHK 1.1.02.00 Unicode 32bit on Win7 Ultimate
;-----------------------------------------------------------------                        
;    ( )   ( )                            
;    /|\   /|\


  • Guests
  • Last active:
  • Joined: --
Thx. It does save one step (e.g. makes it faster) it can already be done by using TF_RemoveLines + TF_Find like so
MsgBox % TF_RemoveRegExLines(var, "i)\san[yd]\s")

MsgBox % TF_RemoveLines(var,TF_Find(var,1,0,"i)\san[yd]\s",0))
TF_Find returns the line number to remove which are use by TF_RemoveLines as start line parameter <!-- m -->https://ahknet.autoh...b.htm#StartLine<!-- m -->