Jump to content

friggin .ini's....


Recommended Posts

oh boy... inis....

so, since, at least on my computer, autoit CONSTANTLY demands some beating into submission, i thought i would make it work using inis.

my primary plan was to use a file that will call up a few variables and i will use said variables to do my bidding. that failed.

now for plan B.

$var = IniRead("C:\Temp\myfile.ini", "section2", "key", "NotFound")

taken directly from the help file, i stared at this little piece of code until i realized it THEORETICALLY CAN DO MY BIDDING PROPERLY (!!!).

Theoretically, however, is a word AutoIt takes VERY seriously.

so i made me a small ini file called OPT.INI with the sole purpose of substituting the god damned file i was intending to use and started modifying my program to work with the ini.

and, so, it's test hour! DRUMROLL PLEASE!

$test=IniRead("@ScriptDir\Data\OPT.ini", "GUI", "BUTTON", "-1")

guess the answer. really. it's not that hard.

MINUS F***ING ONE! (am i allowed to not censor myself here? it is annoying at times...)

now, if you notice the example in the help file, it says that i am indeed allowed to look in OTHER FOLDERS!

while i print my code and set it on fire, please suggest a solution. =D

Link to comment
Share on other sites

  • Developers

You think this is correct: "@ScriptDir\Data\OPT.ini"

Or should it be : @ScriptDir & "\Data\OPT.ini"

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

  • Developers

thanks for your input, but still, no dice >.<

no dice what?

you are sure that:

the inifile exists in the sudir directory data?

the inifile has a valid format and contains the keys?

where is your script stored and run from?

where is your ini file located?

etc etc (Because believe me: you are doing something wrong here!)

Jos

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

SWEET MOTHER OF JESUS I GOT IT!!!

for future reference reference, here's the solution: everything is related to the FILE YOU'RE RUNNING!

Since i was just editing the file that was around the INI, it found it easily because i told the file with the guis that it's around it.

HOW-F***ING EVER..!

i'm having the gui file included in the main file.

when you're running including a file, EVERYTHING is fixed on the state of the MAIN FILE. so, if you have file1 include file2, and file2 is working with files, it is file1 who counts.

THEREFORE

i found that to run the stupid file you need to write the address from FILE1'S PERSPECTIVE!

;file2
                IniWrite("OPT.INI", "GUI", "BUTTON", "1")
                Sleep(10)

will not work because despite being physically around file2. it is actually file1 who accesses it.

IniWrite("Data\OPT.INI", "GUI", "BUTTON", "1")
                Sleep(10)

was in fact the needed solution, and this is snippets from FILE2!!!

Link to comment
Share on other sites

  • Developers

I would appreciate when you cool down a little and think about what you write the next time you decide to post here.

Everything is related to the WorkDir which is the Program directory when you didn't specify an explicit Directory.

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

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