Jump to content

help in creating a file


Recommended Posts

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

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
First 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

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

  • Moderators

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

#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

#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.ini

so ... i can't even do this.. cuz it includes it before it makes the file...

Link to comment
Share on other sites

  • Moderators

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.ini

so ... 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

  • Moderators

Wait... what is:

#include "data.ini" ???

Includes are .au3 extensions.

Edit:

You may actually want to look at FileInstall().

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.

Link to comment
Share on other sites

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

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...