Skrip Posted June 28, 2006 Share Posted June 28, 2006 how can you make autoit write to the first line of a file instead of the last one? [left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left] Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 28, 2006 Moderators Share Posted June 28, 2006 how can you make autoit write to the first line of a file instead of the last one?_FileWriteLine()? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Developers Jos Posted June 28, 2006 Developers Share Posted June 28, 2006 (edited) _FileWriteToLine() Edited June 28, 2006 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
iceberg Posted July 28, 2006 Share Posted July 28, 2006 hi, the above codes actually forces the original first line to the second line and writes itself to the first line. so how do i actually replace the first line? pls help. thanks. mouse not found....scroll any mouse to continue. Link to comment Share on other sites More sharing options...
Xenobiologist Posted July 28, 2006 Share Posted July 28, 2006 HI, _FileWriteToLine has the option to overwrite or not. So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
iceberg Posted August 16, 2006 Share Posted August 16, 2006 thanks th.meger, well how do i add the codes so that by executing the script, it will actually perform the replacement of lines in all text files in a folder. i have heard ppl mentioning abt arrays...but i know nuts abt it. kindkly assist pls. thanks. mouse not found....scroll any mouse to continue. Link to comment Share on other sites More sharing options...
PsaltyDS Posted August 17, 2006 Share Posted August 17, 2006 thanks th.meger,well how do i add the codes so that by executing the script, it will actually perform the replacement of lines in all text files in a folder. i have heard ppl mentioning abt arrays...but i know nuts abt it.kindkly assist pls.thanks.You could use an array, but probably don't need to. There are two parts to what you want:1. Iterate through a list of all .txt files in a folder2. Overwrite the first line on eachFor (1.): Start with FileFindFirstFile(), then use a While loop of FileFindNextFile() to get each .txt fileFor (2.): Copy the files to a backup, then FileOpen() the backup for read and the original file for write. FileReadLine() for one line and FileWriteLine() once with your new first line. Another While loop (this one is nested inside the While loop for 1. above) the repeats FileReadLine()/FileWriteLine(), copying the rest of the backup file to the original.Give a shot and post some code... you'll get more help, I'm sure!Cheers! Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
iceberg Posted August 18, 2006 Share Posted August 18, 2006 Thanks PsaltyDS! With your hints, guidance and encouragement, I am proud to say that I have managed to code the scripts! mouse not found....scroll any mouse to continue. 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