Jump to content

IniRead function BUG


Recommended Posts

Hi, Dev

Just found a bug for the function Iniread, below is my code:

this code will pops up Ini key value, however, when I change the GD.ini file, autoit3 will not reload the INI content until program re-executed.

anyone have solution? thanks.

$var = IniRead("GD.ini", "A", "Key", "NotFound")
MsgBox(4096, "Result", $var)
While 1
    Sleep(Random(2000,5000,1))
    MsgBox(4096, "Result", $var)
    IniWrite("GD.ini", "A", "Key", "test")
WEnd

Below is the GD.ini file:

[A]

Key=US

Key=UK

[C]

Key=INDIA

Link to comment
Share on other sites

The bug is in your code, not autoit.

You declared $var before the loop and never change the contents of $var again no matter how many times it loops. You need to ReRead the Ini (or just re set the variable) if you wish to get an updated value.

MsgBox(4096, "Result", IniRead("GD.ini", "A", "Key", "NotFound"))
While 1
    Sleep(Random(2000,5000,1))
    MsgBox(4096, "Result", IniRead("GD.ini", "A", "Key", "NotFound"))
    IniWrite("GD.ini", "A", "Key", "test")
WEnd
Link to comment
Share on other sites

Sorry, it's my fault....my exact code is not same as above code.. when I just debug my original source code agian and found the possible reason that it is not INI didn't be reload but the IENavigate didn't refresh....

many thanks...pls close/cancel the topic...

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