Jump to content

Clear all text in TXT file


fi3ldy
 Share

Recommended Posts

Hi,

just write "" to it in not append mode or delete it and create it again. :P

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

thx for reply.

how do i create it again, without fileinstall again?? thx alot :P

if cant create again using autoit, ill just have to do filedelete and file install again :D

which wownt work? will it... after its compiled and on a different system, will it beable to fileinstall again?!?!

Edited by fi3ldy
Link to comment
Share on other sites

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

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 by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

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

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... :P

Link to comment
Share on other sites

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...