Jump to content
Sign in to follow this  
Wolfteeth

IniRead function BUG

Recommended Posts

Wolfteeth

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

Share this post


Link to post
Share on other sites
DW1

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

Share this post


Link to post
Share on other sites
Wolfteeth

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

Share this post


Link to post
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
Sign in to follow this  

×