Jump to content
oemript

How to retrieve variable from another ini file?

Recommended Posts

oemript

I would like to know on how to retrieve variable from another ini file.

--------------------------------------

C:\A.ini

labelA = A123

--------------------------------------

C:\B.ini

labelA = retrieve variable labelA from C:\A.ini, which should return A123

--------------------------------------

Does anyone have any suggestions?
Thanks in advance for any suggestions

Share this post


Link to post
Share on other sites
HardXOR
MsgBox(0, "read from A.ini", read_INI("C:\A.ini", "settings", "labelA"))
MsgBox(0, "read from B.ini", read_INI("C:\B.ini", "settings", "labelA"))


Func read_INI($filepath, $section, $key)
    $ini_value = IniRead($filepath, $section, $key, "0")

    If StringLeft($ini_value, 2) = "C:" Then
        $ini_value = IniRead($ini_value, $section, $key, "0")
    EndIf
    Return $ini_value
EndFunc

you can do this

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

×