fi3ldy Posted December 28, 2006 Share Posted December 28, 2006 How do i clear all of the text inside of a text file?? ive not been coding long, so im still a bit new, but struggling along successfully! Any help appriciated, thanks!!! Link to comment Share on other sites More sharing options...
Xenobiologist Posted December 29, 2006 Share Posted December 29, 2006 Hi, just write "" to it in not append mode or delete it and create it again. 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...
fi3ldy Posted December 29, 2006 Author Share Posted December 29, 2006 (edited) thx for reply. how do i create it again, without fileinstall again?? thx alot if cant create again using autoit, ill just have to do filedelete and file install again which wownt work? will it... after its compiled and on a different system, will it beable to fileinstall again?!?! Edited December 29, 2006 by fi3ldy Link to comment Share on other sites More sharing options...
rambo3889 Posted December 29, 2006 Share Posted December 29, 2006 filedelete("Your textfile.txt") filewrite("Your textfile.txt","") Think that should do it My Scripts:Radioblog Club Music DownloaderOther stuff:Fun movieIm serious read the help file it helps :PFight 'Till you drop. Never stop, You Cant give up. Til you reach the top Fight! youÂ’re the best in town Fight! Link to comment Share on other sites More sharing options...
fi3ldy Posted December 29, 2006 Author Share Posted December 29, 2006 thx alot buddy! Link to comment Share on other sites More sharing options...
rambo3889 Posted December 29, 2006 Share Posted December 29, 2006 Np im glad that i could help, My Scripts:Radioblog Club Music DownloaderOther stuff:Fun movieIm serious read the help file it helps :PFight 'Till you drop. Never stop, You Cant give up. Til you reach the top Fight! youÂ’re the best in town Fight! Link to comment Share on other sites More sharing options...
herewasplato Posted December 29, 2006 Share Posted December 29, 2006 FileClose(FileOpen("c:\temp\test.txt", 2)) [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted December 29, 2006 Share Posted December 29, 2006 dangit plato beat me to it Link to comment Share on other sites More sharing options...
herewasplato Posted December 29, 2006 Share Posted December 29, 2006 dangit plato beat me to itI got roller blades for my walker for Christmas :-) [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
fi3ldy Posted December 29, 2006 Author Share Posted December 29, 2006 thx for all the help, rambo's way worked just fine for me Link to comment Share on other sites More sharing options...
Xenobiologist Posted December 29, 2006 Share Posted December 29, 2006 Hi, beware in both cases there will be created an empty file even if there wasn't a file before. Maybe you don't want that. 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...
dandymcgee Posted December 29, 2006 Share Posted December 29, 2006 (edited) HA! rambo beat you both Edited December 29, 2006 by dandymcgee - Dan [Website] Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted December 29, 2006 Share Posted December 29, 2006 Umm I meant for the method that plato used which is a Better then deleting then writing nothing to it. Link to comment Share on other sites More sharing options...
herewasplato Posted December 29, 2006 Share Posted December 29, 2006 (edited) Hi, beware in both cases there will be created an empty file even if there wasn't a file before. Maybe you don't want that. So long, Mega$path = "c:\temp\test.txt" If FileExists($path) And FileRead($path) <> "" Then FileClose(FileOpen($path, 2))I could make it one line, but then it would not post well... so two lines it is - even if one line might wrap in your display. :-) Edited December 29, 2006 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
herewasplato Posted December 29, 2006 Share Posted December 29, 2006 Umm I meant for the method that plato used which is a Better then deleting then writing nothing to it.I'm glad that you figured that out... I pondered dandymcgee post a bit - but after all, he is "Valik's #1 Fan" :-)@OP,We know you have your solution - we are just playing - and showing you other (better?) ways to do what you asked for. [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
dandymcgee Posted December 29, 2006 Share Posted December 29, 2006 (edited) uhhh.... EDIT! Edited December 29, 2006 by dandymcgee - Dan [Website] Link to comment Share on other sites More sharing options...
fi3ldy Posted December 29, 2006 Author Share Posted December 29, 2006 calm down boys, the file WILL be there anyway as its installed at the begiining of the script, also as soon as i used FileWrite i used FileWriteLine to write the title inside, basically refreshing the text doc, its for logging... Link to comment Share on other sites More sharing options...
Zedna Posted December 29, 2006 Share Posted December 29, 2006 Another way: #include <APIFileReadWrite.au3> $path = 'C:\file.txt' $file = _APIFileOpen( $path ) _APIFileSetPos( $file, 0 ) ; maybe this line is not neccesary _APIFileSetEnd( $file ) _APIFileClose( $file ) Resources UDF Â ResourcesEx UDF Â AutoIt Forum Search Link to comment Share on other sites More sharing options...
fi3ldy Posted December 29, 2006 Author Share Posted December 29, 2006 the other way tends to be alot more, "simple" for my inexperienced brain to cope with atm Link to comment Share on other sites More sharing options...
herewasplato Posted December 29, 2006 Share Posted December 29, 2006 What exactly are you implying by this? I was simply noting that Rambo had posted the first working solution,..Nothin'.It was the first time that I had noticed that custom title of yours. I just thought that I would mention it. I probably did not do so in the best manner.It did take me a while to figure out your post, but I just wrote that off to my not feeling all that well that day (and not that much better today). Once Thatsgreat2345 posted, your post made sense to me.As to what code is better... I was not willing to make any claims on that. That is why I put (better?) like I did. When the results are not critical and you can live without error checking, then a single line of code like that is "better" for my tastes... but like you said, it is really up to the OP to pick a solution from among those offered. I don't care if the one that I posted is not picked. The thread has a good title, so others may read it at some point in the future... it is nice to have a few coding options posted.Thanks for all that you contribute to the forum - keep up the good work. Again, sorry if my post struck you wrong - it was not intended to do so. [size="1"][font="Arial"].[u].[/u][/font][/size] 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