Jump to content

#include and close question


Recommended Posts

hi all,

i want to #include "/settings.txt"

its in the same folder as where the .au3 file is.

i also tryed renaming the .txt to .c or .au3 but it can't open the file.

i wanne use it like:

#include <array.au3>

Local $array1[2]; 
Local $array2[2]; 
Local $array3[2]; 

#include "/settings.txt"

and in the .txt file you wil have then:

$array1[0] = 0
$array1[1] = 0
$array2[0] = 0
$array3[1] = 0
$array4[0] = 0
$array5[1] = 0

where in settings array settings are set. so people that use my script only have to edit the .txt and not the source.

would be even more super when i can make the source a .exe and get the vars from the .txt so they can run the .exe and dont need to run the script.

my second problem is ctrl + break to pause doesnt always work sometimes i need to press in 20 times. i think when i am in a sleep. is there a way to interrupt it better? or a way to make a delay that can be paused when its running?

with kind regard

mike

Edited by Mike23
Link to comment
Share on other sites

Why don't you use the IniRead()/IniWrite() functions instead? That way it will work when the script is compiled as well.

wil look into those commands ^_^

*edit:

when i look into the database it wil get a value from the file?

or can you get variables from it to. like $x = 20;

Edited by Mike23
Link to comment
Share on other sites

  • Developers

C:\Documents and Settings\Administrator\Bureaublad\script\script v0.2.au3 (16) : ==> Error opening the file.:

#include "settings.txt"

works fine here, so you must be doing something wrong.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

when i look into the database it wil get a value from the file?

or can you get variables from it to. like $x = 20;

You can save the value to a variable.

$x=IniRead("some.ini","section1","x",0)

Broken link? PM me and I'll send you the file!

Link to comment
Share on other sites

works fine here, so you must be doing something wrong.

Jos

see what i did wrong i had settings.txt.txt ^_^

You can save the value to a variable.

$x=IniRead("some.ini","section1","x",0)
Got your methode working now.

Got a new question now:

How do i make it with an array[100];

where every location is "000 000" so this 100 times and it must come in an array.

i was thinking of something like:

iniWrite ( "Settings.ini", "--- Array---", "sizeof", "4" )
IniWrite ( "Settings.ini", "--- Array---", "1", "000 000" )
IniWrite ( "Settings.ini", "--- Array---", "2", "000 000" )
IniWrite ( "Settings.ini", "--- Array---", "3", "000 000" )
IniWrite ( "Settings.ini", "--- Array---", "4", "000 000" )


$size = IniRead("Settings.ini","--- Array---","sizeof","NotFound")
Local $array[100];

For $i = 1 to $size Step 1
  $array[$i]= IniRead("Settings.ini","--- Array---","1","NotFound")
  MsgBox(0, "Value!", $array[$i])
Next
    MsgBox(0,"", "rdy!")

didn't test yet if i can read on location $i yet. dunno if there is an easyer way?

*edit

tested it can't read with $i, anny1 got a trick for this?

Edited by Mike23
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...