Sign in to follow this  
Followers 0
rizwan

Filewriteline

5 posts in this topic

When i restart my system the file is not appending

I am using the following code

$file = FileOpen("C:\tools\scripts\Logtime.txt", 1)

; Check if file opened for writing OK

If $file = -1 Then

MsgBox(0, "Error", "Unable to open file.")

Exit

FileWriteLine($file, "Start time is " & _NowTime())

Please advise

Share this post


Link to post
Share on other sites



When i restart my system the file is not appending

I am using the following code

$file = FileOpen("C:\tools\scripts\Logtime.txt", 1)

; Check if file opened for writing OK

If $file = -1 Then

MsgBox(0, "Error", "Unable to open file.")

Exit

FileWriteLine($file, "Start time is " & _NowTime())

Please advise

it doesn't look like you're closing your file, but i don't know if that would cause the issue you're seeing. You may want to just use _FileWriteLog(), you can cut out some of your code that way...

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

it doesn't look like you're closing your file, but i don't know if that would cause the issue you're seeing. You may want to just use _FileWriteLog(), you can cut out some of your code that way...

Thanks for your help. actually using the fileclose function worked. I think fileclose should be required after a fileopen. Becuz currently if you goto autoit help it says fileclose is not necessary

Share this post


Link to post
Share on other sites

Thanks for your help. actually using the fileclose function worked. I think fileclose should be required after a fileopen. Becuz currently if you goto autoit help it says fileclose is not necessary

yes, the current (beta) text reads:

When finished working with a file, call the FileClose function to close the file. Autoit normally closes all files upon termination, but explicitly calling FileClose is still a good idea.


1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

It doesn't say that FileClose "is not necessary", it says for FileWriteLine() "If a filename is given rather than a file handle, the file will be opened and closed during the function call."... But you used FileOpen() with a "handle" ($file = FileOpen()... FileWriteLine($file), so it is neccessary and actually the examples for FileOpen() / FileWriteLine(), both show a FileClose() routine in them.


[center]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.[/center]

Share this post


Link to post
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
Sign in to follow this  
Followers 0