Jump to content
Sign in to follow this  
bluebearr

reading ini

Recommended Posts

Or you can try this:

$workingdir = RegRead("HKEY_CURRENT_USER\Software\Ascaron Entertainment\Sacred Underworld","InstallLocation")
$alltext = FileRead($workingdir & "\settings.cfg", FileGetSize($workingdir & "\settings.cfg"))
$alltextArray = StringSplit($alltext, @CRLF)            ; array, one line per item
For $i = 1 to $alltextArray[0]
    $lineA =StringSplit($alltextArray[$i], " : ", 1)    ; split lines
    if $lineA[0] > 1 Then                               ; Skip blank lines
        If $lineA[1] = "NETWORK_LOBBYLOGIN" Then
            MsgBox(4096, "Test", $lineA[2])
        EndIf
    EndIf
Next

BlueBearrOddly enough, this is what I do for fun.

Share this post


Link to post
Share on other sites

hey guys,

I wanna read a ini file here from a game but can't get it to work.

here's the script that I tried:

$workingdir = RegRead("HKEY_CURRENT_USER\Software\Ascaron Entertainment\Sacred Underworld","InstallLocation")
$char = IniRead( $workingdir & "\settings.cfg", "default", "NETWORK_LOBBYLOGIN :", "default")
MsgBox(4096, "Test", $char)

and here's the part of the ini:

NETWORK_LOBBYLOGIN : bananarama

NETWORK_LOBBYPORT : 7066

NETWORK_PLAYER :

NETWORK_PORT_LISTEN : 2005

I want it to display me the bananarama value or whatever that's filled in there.

Note that the ini file doesn't have sections and there's no = but : instead

any ideas please?

the $workingdir points to the correct path for sure since I'm using this already elsewhere in the script.

Share this post


Link to post
Share on other sites

NETWORK_LOBBYLOGIN : bananarama

NETWORK_LOBBYPORT : 7066

NETWORK_PLAYER :

NETWORK_PORT_LISTEN : 2005

This doesn;t look like a proper ini file so I am not supprised it doesn't work ...

Share this post


Link to post
Share on other sites

This doesn;t look like a proper ini file so I am not supprised it doesn't work ...

any idea how to get it to work?

otherwise I would going to need to use OCR to read the name onscreen when he logs in. I just need to check the accountname.

I'm trying to build in a securitymeasure here.

the settings.cfg file gets displayed as a microsoft-office outlook configuration file.

Edited by Overlord

Share this post


Link to post
Share on other sites

try something like:

$workingdir = RegRead("HKEY_CURRENT_USER\Software\Ascaron Entertainment\Sacred Underworld","InstallLocation")
$line = FileRead($workingdir & "\settings.cfg")
$line = StringSplit($line," : ")
MsgBox(0,$line[1],$line[2])

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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  

×
×
  • Create New...