Sign in to follow this  
Followers 0
anixon

INIRead

6 posts in this topic

This code is to perform multiple reads of an INI file [3 in this example but it could be 33 or any other number for that matter]

#include <string.au3>

Const $ScriptDir = @ScriptDir & "\test.ini"

Global $BeepNum = "", $PingID1 = "", $PingID2 = ""

Global $LData[3] = ["$BeepNum|Section1|value|4", "$PingID1|Section2|value|0", "$PingID2|Section3|value|0"]]

For $i = 0 To UBound($LData) - 1

$LICENCEData = _StringSplit($LData[$i], "|")

$INIRead = IniRead($ScriptDir,$LICENCEData[1],$LICENCEData[2],$LICENCEData[3])

If $LICENCEData[0] = "$BeepNum" then $BeepNum = $INIRead

If $LICENCEData[0] = "$PingID1" then $PingID1 = $INIRead

If $LICENCEData[0] = "$PingID2" then $PingID2 = $INIRead

Next

Exit

Whilst it works how do I assign the INI file value for $BeepNum, $PingID1 and $PingID2 for as many items as there might be without having to use an individual IF statements

to assign the INI value to each variable. Ant.. :)

Share this post


Link to post
Share on other sites



Assign($LICENCEData[0], $INIRead)

Share this post


Link to post
Share on other sites

Assign($LICENCEData[0], $INIRead)

RR another Kentucky winner..... Thanks for your help tis much appreciated keep Ant.. [Melbourne Cup Territory] :)

Share this post


Link to post
Share on other sites

Assign(StringTrimLeft($LICENCEData[0], 1), $INIRead)

or dont use '$' for vars in array


I see fascists...

Share this post


Link to post
Share on other sites

Assign(StringTrimLeft($LICENCEData[0], 1), $INIRead)

or don't use '$' for var names in array

Thanks for that as you have pointed out you indeed to not need to us '$' in the array. Ant.. :)

Share this post


Link to post
Share on other sites

Thanks for that as you have pointed out you indeed to not need to us '$' in the array. Ant.. :)

I should have noted the time before posting. server went down momentarily causing duplicate posts.

every now and then if I'm on the forum around 8AM GMT (3AM where I am)

the site gives internal server errors and wont load pages or process posts.

down for maintenance routines I assume.


I see fascists...

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  
Followers 0