Ham123 Posted May 22, 2009 Share Posted May 22, 2009 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? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 22, 2009 Moderators Share Posted May 22, 2009 (edited) 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")Endifafter 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 May 22, 2009 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. 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