DNnlee Posted May 10, 2008 Share Posted May 10, 2008 i am trying to make the script check if "DATA.INI" exists.... if it does, it'll include whatever is in data.ini if data.ini does not exist already... it'll run a file called "create data.au3", which creates a file called "data.ini" i got a error saying it can't "include Data.ini", but i don't even have that file yet.. so shouldn't it ignore that line? If FileExists("Data.ini") Then #include "Data.ini" Else Run("Create Data.au3" ) EndIf Link to comment Share on other sites More sharing options...
botanic Posted May 10, 2008 Share Posted May 10, 2008 (edited) an #include cant be in an if then statment If FileExists("Data.ini") = false Then Run("Create Data.au3" ) EndIf #include "Data.ini" Edited May 10, 2008 by botanic Link to comment Share on other sites More sharing options...
DNnlee Posted May 10, 2008 Author Share Posted May 10, 2008 (edited) an #include cant be in an if then statment If FileExists("Data.ini") = false Then Run("Create Data.au3" ) EndIf #include "Data.ini" can i fit #include into a for statement? i don't want to "#include" if the file doens't exist EDIT: ahh.. i understand now.. thx Edited May 10, 2008 by DNnlee Link to comment Share on other sites More sharing options...
Generator Posted May 10, 2008 Share Posted May 10, 2008 i am trying to make the script check if "DATA.INI" exists.... if it does, it'll include whatever is in data.ini if data.ini does not exist already... it'll run a file called "create data.au3", which creates a file called "data.ini" i got a error saying it can't "include Data.ini", but i don't even have that file yet.. so shouldn't it ignore that line? If FileExists("Data.ini") Then #include "Data.ini" Else Run("Create Data.au3" ) EndIfFirst this is not VB so you cannot add resource directly into your file by including it. Including a file is usually referring to a library. Please check out FileInstall() for more detail. If you want to make an ini, it is clearly stated in IniWrite() if the file do not exist it will make a new 1. Alternatively you can use _FileCreate() which is a UDF included to make ini files. _ an #include cant be in an if then statment If FileExists("Data.ini") = false Then Run("Create Data.au3" ) EndIf #include "Data.ini"Same if the ini is not there when a write func is performed it will write a new 1. Link to comment Share on other sites More sharing options...
botanic Posted May 10, 2008 Share Posted May 10, 2008 um the script posted will first check to see if the file exists. If it does not it will Run("Create Data.au3" ) then after that is done it will include the file. Really I cant think of any way to only include a file if it exists. I assume that the Run("Create Data.au3" ) will create the file if so you can try Runwait("Create Data.au3" ) Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 10, 2008 Moderators Share Posted May 10, 2008 can i fit #include into a for statement?i don't want to "#include" if the file doens't existEDIT: ahh.. i understand now.. thx#includes are included at compile time. They are not a condition that can be turned on or off. 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...
DNnlee Posted May 10, 2008 Author Share Posted May 10, 2008 #includes are included at compile time. They are not a condition that can be turned on or off.it seems like the script gives #include a priority....i tried to put this line everywhere else and i still get a error before the script does anything..RUn(create data.au3) ; this program makes the data.ini file#include data.iniso ... i can't even do this.. cuz it includes it before it makes the file... Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 10, 2008 Moderators Share Posted May 10, 2008 it seems like the script gives #include a priority....i tried to put this line everywhere else and i still get a error before the script does anything..RUn(create data.au3) ; this program makes the data.ini file#include data.iniso ... i can't even do this.. cuz it includes it before it makes the file...Yes, as I said. 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...
Moderators SmOke_N Posted May 10, 2008 Moderators Share Posted May 10, 2008 (edited) Wait... what is: #include "data.ini" ??? Includes are .au3 extensions. Edit: You may actually want to look at FileInstall(). Edited May 10, 2008 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...
Generator Posted May 10, 2008 Share Posted May 10, 2008 DNnlee you are on the right track but using the wrote code. As Smoke_N said and I stated if you want resources look in FileInstall(), and to make a file use _FileCreate() if needed. Link to comment Share on other sites More sharing options...
DNnlee Posted May 10, 2008 Author Share Posted May 10, 2008 DNnlee you are on the right track but using the wrote code. As Smoke_N said and I stated if you want resources look in FileInstall(), and to make a file use _FileCreate() if needed.yea... i decided to use .ini instead... it's a little bit smarter at reading thx everyone, i'll continue workin on it 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