Jump to content

Ini Read Problem


Recommended Posts

Hello

Probably a really silly solution to this, but Im trying to read a ini file with 2 values with a random Section Name i.e

[Computer Name 1]

IP= 1.1.1.1

Mac=001AA0BC8A12

[Name computer 2]

IP= 1.1.1.2

Mac=001AA0BC898C

[Random Name 3]

IP= 1.1.1.3

Mac=001AA0BC92C0

However I am getting the results on 2 different lines rather then one.

So instead of

2009-04-16 13:32:05 : Computer Name is : VTG000005 IP is : 192.168.212.78 Mac is : 001AA0BC8A12

I'm getting

2009-04-16 13:32:05 : Computer Name is : VTG000005 IP is : IP Mac is : 192.168.212.78

2009-04-16 13:32:06 : Computer Name is : VTG000005 IP is : Mac Mac is : 001AA0BC8A12

#include<file.au3>

$sar = IniReadSectionNames(@ScriptDir & "\Woz.ini")
If @error Then
    MsgBox(4096, "", "Error occurred, probably no INI file.")
Else
    For $s = 1 To $sar[0]
         MsgBox(4096, "", $sar[$s])
        $var = IniReadSection("G:\FourS\SiteShare\CentraStage\woz.ini", $sar[$s])
        For $i = 1 To $var[0][0]
            MsgBox(4096, $sar[$s], "Key: " & $var[$i][0] & @CRLF & "Value: " & $var[$i][1])
            _FileWriteLog(@ScriptDir & "\Woz.log", "Computer Name is : " & $sar[$s] & " IP is : " & $var[$i][0] & " Mac is : " & $var[$i][2])
        Next
    Next
EndIf
Link to comment
Share on other sites

$sar = IniReadSectionNames(@ScriptDir & "\Woz.ini")
If @error Then
    MsgBox(4096, "", "Error occurred, probably no INI file.")
Else
    For $s = 1 To $sar[0]
        $var = IniReadSection("G:\FourS\SiteShare\CentraStage\woz.ini", $sar[$s])
        _FileWriteLog(@ScriptDir & "\Woz.log", "Computer Name is : " & $sar[$s] & " IP is : " & $var[1][1] & " Mac is : " & $var[2][1])
    Next
EndIf

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