AutoHotkey Community

It is currently May 27th, 2012, 1:13 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 51 posts ]  Go to page Previous  1, 2, 3, 4

Should it be continued?
No, these are completely useless
Yes, add more and more, make it big
You may select 1 option

View results
Author Message
 Post subject: TXT_RemoveLines
PostPosted: May 24th, 2009, 5:15 pm 
TXT_RemoveLines ends up removing the lines but the new version is appended to the old version in the text file. Obviously, the old version should be erased and only the modified version written to it. Why is the append happening?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 9th, 2009, 2:31 pm 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
UPDATE July 2009 New library:
http://www.autohotkey.com/forum/viewtopic.php?t=46195

_________________
AHK FAQ
TF : Text files & strings lib, TF Forum


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 9th, 2009, 7:06 pm 
Offline

Joined: February 20th, 2007, 1:37 pm
Posts: 198
Location: D.C.
Thanks HugoV!


Report this post
Top
 Profile  
Reply with quote  
 Post subject: TF TextFile) Library
PostPosted: October 28th, 2009, 1:29 pm 
Offline

Joined: January 24th, 2009, 3:22 pm
Posts: 13
Location: Aldersbach, Germany
Hallo!
I have come across, as it were, through the back-door, the TF Library and have downloaded it and printed out the documentation.
Let me begin by offering a word of praise and congratulations to the developer and his ability to describe what he has realised and offers.
I am currently in search of tools to autome a simple model, for translating from English to German, which I have built.
The model operates for me in a manual environment; I feel sure that automating some, if not all of the steps, will make it more useful and usable, conceivably even for others.
I am now going to begin exploring what is in the script, which I have downloaded.
Because the documentation, in terms of the function the product offers, is so well organised, I hope to be able to compare the function with what I have defined in my model.
This comparison will, I hope, also indicate what is not covered and perhas where I can adjust my model to meet the function offered.
I also expect that the TF Library will not offer all that I need, but will be a good basis, to suggest extensions.
On thinking about the TF library structure and function, it has one additional advantage and that is maybe to understand how to build a "Text Manipulation IDE" for users whose work involves in the main text manipulation.
I would like to dialogue with the developer and others who use the TF Library during my initial testing, so that I am kept on the right track,
perhaps also being given help when I need it.
Once again congratulatiions on ostensbily a good product.
I look foward to contacts. Kind regards, forkinpm.

_________________
I am building my platform based on a set of steps to take my English texts through segmenting into phrases, resequencing segments based on German rules, adding head-words and then translating with my dictionary.
Regards, forkinpm.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 28th, 2009, 1:41 pm 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
Although slightly biased I strongly suggest you use the "new" version of this library TF.ahk A Library for Text file manipulation or http://www.autohotkey.net/~hugov/tf-lib.htm [working on new version]

If you need a CSV library, I suggest:

Fairly elaborate CSV functions by trueski
http://www.autohotkey.com/forum/topic42843.html

http://www.autohotkey.com/forum/viewtopic.php?t=46195
Update November 2009:
Now works with variables as well

_________________
AHK FAQ
TF : Text files & strings lib, TF Forum


Report this post
Top
 Profile  
Reply with quote  
 Post subject: RegExReplace
PostPosted: February 15th, 2010, 7:25 pm 
Offline

Joined: February 14th, 2010, 6:28 pm
Posts: 1
Hi
I have a text file with 4 rows and a value 0 or 1 in each row. When I change one value (from outer web with javascript), the letter A is written beside it. It looks like this:

settings.ini
1
0
1A
0

With AHK I would like to delete the letter A and get the row number and the row value, so I can trigger the right switch (call procedure). I think that with TXT_RegExReplace I'm close enough, but I just can't extract these two values. Please help.

Code:
#t::
TriggerFilename=d:\myweb\cgi-bin\settings.ini
TXT_RegExReplace("!" . TriggerFilename, 1, 4, "A", "")
Return

TXT_RegExReplace(TextFile, StartLine, EndLine, NeedleRegEx, Replacement=""){

Original := A_BatchLines
SetBatchLines, -1
    TextFile := (SubStr(TextFile,1,1)="!") ? (SubStr(TextFile,2),OW=1) : TextFile
    FileRead, Str, %TextFile%
    Loop, Parse, Str, `n, `r
    {
        If A_Index between %StartLine% and %Endline%
        {
            OutPut .= RegExReplace(A_LoopField, NeedleRegEx, Replacement, Count)
            OutPut .= "`n"
            Counts += Count
            LineNo .= Count
        }
        Else
            OutPut .= A_LoopField "`n"
    }
    If OW {
        FileDelete, %TextFile%
        FileAppend, %OutPut%, %TextFile%
        MsgBox % "Line No. : " LineNo
    }
    Else {
        SplitPath, TextFile,, Dir, Ext, Name
        FileDelete, % Dir "\" Name "_copy." Ext
        FileAppend, %OutPut%, % Dir "\" Name "_copy." Ext
    }
SetBatchLines, %Original%
    Return Counts
}


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 51 posts ]  Go to page Previous  1, 2, 3, 4

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bon and 14 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group