J0ker Posted March 5, 2007 Share Posted March 5, 2007 (edited) Hi, I'm having a problem with an IniWrite. I have a file named config.ini and and when my script exit , it reset all variables to 0 in this file. The problem is if the config.ini file doesnt exit, it will create one and I DONT want that to happen. Is there anyway to prevent the script from creating the config.ini if it's not there? Func Terminate() IniWrite(@SCRIPTDIR & "\Config.ini", "Settings", "First", "0") IniWrite(@SCRIPTDIR & "\Config.ini", "Settings", "Second", "0") IniWrite(@SCRIPTDIR & "\Config.ini", "Settings", "Third", "0") IniWrite(@SCRIPTDIR & "\Config.ini", "Settings", "Fourth", "0") IniWrite(@SCRIPTDIR & "\Config.ini", "Settings", "Fifth", "0") Exit(0) EndFunc ;==> Terminate Edited March 5, 2007 by J0ker Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 5, 2007 Moderators Share Posted March 5, 2007 You told it to do only that ... Just do:Func Terminate() If FileExists(@SCRIPTDIR & "\Config.ini") Then IniWrite(@SCRIPTDIR & "\Config.ini", "Settings", "First", "0") IniWrite(@SCRIPTDIR & "\Config.ini", "Settings", "Second", "0") IniWrite(@SCRIPTDIR & "\Config.ini", "Settings", "Third", "0") IniWrite(@SCRIPTDIR & "\Config.ini", "Settings", "Fourth", "0") IniWrite(@SCRIPTDIR & "\Config.ini", "Settings", "Fifth", "0") EndIf Exit(0) EndFunc ;==> Terminate 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...
J0ker Posted March 5, 2007 Author Share Posted March 5, 2007 Thx Smoke! Why I did not think of that 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