Jump to content
Sign in to follow this  
Ham123

autoit files gone after using commands?

Recommended Posts

Ham123

Was working on implementing a new feature in a program i was practically done with..in which the users could log what has happened.

so basically it went like this:

#include <File.au3>

If fileopen("C:\.....\settings.txt", 0) = 0 Then

_filecreate("C:\autoitprograms\log.txt)

Else

filedelete("C:\autoitprograms\log.txt")

_filecreate("C:\autoitprograms\log.txt")

Endif

after running this..all of the files located in my main autoit folder were deleted. After this happened, I looked through the recycling bin, and also conducted a search..but they're gone. could someone explain this to me?

Share this post


Link to post
Share on other sites
SmOke_N

Was working on implementing a new feature in a program i was practically done with..in which the users could log what has happened.

so basically it went like this:

#include <File.au3>

If fileopen("C:\.....\settings.txt", 0) = 0 Then

_filecreate("C:\autoitprograms\log.txt)

Else

filedelete("C:\autoitprograms\log.txt")

_filecreate("C:\autoitprograms\log.txt")

Endif

after running this..all of the files located in my main autoit folder were deleted. After this happened, I looked through the recycling bin, and also conducted a search..but they're gone. could someone explain this to me?

FileOpen returns a handle or -1 (Never zero). So the "If" conditional statement could never be true. So it will always be the "Else" statement which deletes the files.

Also, the way you're using FileOpen() shouldn't be done that way... Not storing the handle will make it kind of hard to use FileClose() later.

Edited by SmOke_N

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.

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.