Scanzee Posted November 30, 2005 Share Posted November 30, 2005 Is it possible that the text you write in an .txt file comes on the top of the file and not on the end?! (Like FileWrite("...",1) does Let me know.. and a second question if the previous prob. works: Is it possible that you put a limit on a .txt file. So the file does't become so big. Thanks for any help... Link to comment Share on other sites More sharing options...
BigDod Posted November 30, 2005 Share Posted November 30, 2005 Is it possible that the text you write in an .txt file comes on the top of the file and not on the end?!(Like FileWrite("...",1) doesLet me know..and a second question if the previous prob. works: Is it possible that you put a limit on a .txt file. So the file does't become so big.Thanks for any help...FileWriteLine will do the first part of your question. I have not found an answer to the size limit. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
Scanzee Posted November 30, 2005 Author Share Posted November 30, 2005 What is the code of that because i tried a couple of time but it didn't work... Link to comment Share on other sites More sharing options...
BigDod Posted November 30, 2005 Share Posted November 30, 2005 What is the code of that because i tried a couple of time but it didn't work...I am sorry I have just told you a lot of junk :"> :"> :"> Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
Excalibur Posted November 30, 2005 Share Posted November 30, 2005 What you could do to fix both your problems, is to open the file, read the text in it to memory (a variable), then write OVER the file what you want at the top, then write your file that you had in memory. And as for keeping your file a certain length. You can do that in a few ways, depending on what you concider as a "length" 100 lines, 10k. 20 Messages. But in any case, all you do is go through, read the file, and count. if you tell me what way you wish to count, i can help you in more detail. Hope i was of some help. :-) Ooo Ëxçã¿îbúr ooO"Information Is Not Knowledge." ~Albert Einstein Link to comment Share on other sites More sharing options...
kjactive Posted November 30, 2005 Share Posted November 30, 2005 (edited) True - most languages has a seek function to seek in a location to append text, but Autoit do not but it is also a very slow method as disk speed can't compare with cpu, I would just loadin all text to do the changes and save the changed text as a new file, this also gives an option to do an undo etc. and all parametres of the text as amound of characters is easy to provide - just do it the simple way and do not think of autoit3 as just anouther language as it is not - it's a automation language with a lot of simplisities but cable on doing most tasks if one use intuition and some walk arounds... kjactive Edited November 30, 2005 by kjactive Au3PP 4.1 - Autoit3 preprocessor, optimize speed, performance to scripts and do executes....[/url]Au3Calibur - Create libraries of commonly used code excerptsWords manipulate UDF, functions that is lent from the rexx language, topics and index file includedCustomDialog UDF to include custom made dialogs like a extended colorpick requester to scripts...[url="ftp://fritidshjemmet.com/Autoit3/SysColor.zip"]SysColor UDF a low level color library to manipulate RGB and Hex values...Shell32 UDF to Automate Windows® operating tasks from native dialog and Wizards browsers... Optimized the CodeWicard with options to generate browser code etc... Link to comment Share on other sites More sharing options...
Scanzee Posted November 30, 2005 Author Share Posted November 30, 2005 About 100 lines in a .txt file is enough... Thanks for all help... Link to comment Share on other sites More sharing options...
LxP Posted December 1, 2005 Share Posted December 1, 2005 This should come close to what you want: Local $File = 'C:\TheFile.txt' Local $Data = 'This line will be added to the top of the file.' & @CRLF ; Add the data from the file $Data = $Data & FileRead($File, FileGetSize($File))) ; Trim any data after the 100th line Local $TrimPoint = StringInStr($Data, @CRLF, 0, 100) If $TrimPoint Then $Data = StringLeft($Data, $TrimPoint + 1) ; Write the new data to the file FileDelete($File) FileWrite($File, $Data) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now