Jump to content

How to retrieve variable from another ini file?


Recommended Posts

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

Link to comment
Share on other sites

  • Developers

Retrieve with what assuming this is not supposed to be an AutoIt3 question seeing the forum it is posted in?

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

  • 2 months later...
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

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