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
faqbot
  • Members
  • 997 posts
  • Last active:
  • Joined: 10 Apr 2012

Open the log file in your editor and try to see what format the file is, perhaps it is Unix or Mac not DOS/Windows (Ansi) - try changing the format if you see it is not dos/win - Notepad++ makes it real easy, don't know about SublimeText. I can't think of a reason why it would insert the line numbers. You could try and edit TF.ahk  and look for these lines (823 or so)

				 Else If (ReturnText = 2)
					Lines .= A_Index ": " A_LoopField "`n" ; add line number

and remove A_Index ": " part - that way it can never insert the line numbers - if the linenumbers are still there after this change they come from somewhere else.



Elalya
  • Members
  • 8 posts
  • Last active: Jul 09 2014 08:27 AM
  • Joined: 28 Jun 2014

This is great. Thank you for the support! 

 

This weekend I am going to take a look a look to see if I can figure out why it was putting those line numbers in.



hq320
  • Members
  • 2 posts
  • Last active: Nov 19 2014 08:34 PM
  • Joined: 08 Oct 2014

Hello, very good lib.

I am quit new aith ahk so its bit different from php, and other codes i have been using.

 

Is it possible to get all names from

String:

Seat 1: BiGFa4TMaN90 (11.38 in chips) 
Seat 3: _Barttman_DR (23.57 in chips) 
Seat 4: Chersttkov (24.75 in chips) 
Seat 5: olsenfalWcon (20 in chips) 
Seat 6: RAIK3O90 (27.46 in chips) 
Seat 7: mojitfoPRO (25 in chips) 
Seat 8: KaldDaPoiss (25 in chips) 

Seat 9: SupefrZacep (27.16 in chips)  

 

Using something similar:

FoundPos := RegExMatch("String", "Seat[0-9](.*)(", SubPat) ??

 

And Get:
MsgBox %SubPat1% will show :BiGFa4TMaN90
MsgBox %SubPat2% will show :_Barttman_DR
MsgBox %SubPat3% will show :Chersttkov
MsgBox %SubPat4% will show :Chersttkov
MsgBox %SubPat5% will show :olsenfalWcon
MsgBox %SubPat6% will show :RAIK3O90
MsgBox %SubPat7% will show :mojitfoPRO
MsgBox %SubPat8% will show :KaldDaPoiss 
MsgBox %SubPat9% will show :SupefrZacep 
 
 
 


asa32sd23
  • Members
  • 20 posts
  • Last active: Apr 11 2015 04:23 PM
  • Joined: 06 Nov 2014

this TF library is genius and so helpful...

 

I needed some help figuring out best approach to sending lines to a new or existing file...

 

I have 1 text fil with 5000 lines. I have the loop and the If In String BUT how do i send each instance found (each line) to a new file or existing file?

 

loop, read, %TextFile%

{

            StringSplit, Line_Array, A_LoopReadLine, `,

            IfInString, Line_Array1, -                           

                ** Send line to new or existing file **

}



space
  • Members
  • 520 posts
  • Last active:
  • Joined: 12 Aug 2014

You can use the http://ahkscript.org.../FileAppend.htmcommand.

 

If you want to do it all with TF it would be something like this (replace the text variable with the filename)

text=
(join`r`n
1 lorem impsum, data, more data
2 lorem - impsum, data, more data
3 lorem impsum, data, more data
4 lo-rem impsum, data, more data
)

Lines:=TF_Find(Text, , , "m)^[^,]*-", 0, 1)
MsgBox %Lines%
 
;or in one line:

TF_Save(TF_Find(Text, , , "m)^[^,]*-", 0, 1),"foundlines.txt")