bluebearr Posted July 16, 2006 Share Posted July 16, 2006 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. Link to comment Share on other sites More sharing options...
Overlord Posted July 16, 2006 Share Posted July 16, 2006 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. Link to comment Share on other sites More sharing options...
Developers Jos Posted July 16, 2006 Developers Share Posted July 16, 2006 NETWORK_LOBBYLOGIN : bananaramaNETWORK_LOBBYPORT : 7066NETWORK_PLAYER : NETWORK_PORT_LISTEN : 2005This doesn;t look like a proper ini file so I am not supprised it doesn't work ... 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 More sharing options...
Overlord Posted July 16, 2006 Share Posted July 16, 2006 (edited) 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 July 16, 2006 by Overlord Link to comment Share on other sites More sharing options...
GaryFrost Posted July 16, 2006 Share Posted July 16, 2006 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. Link to comment Share on other sites More sharing options...
Overlord Posted July 17, 2006 Share Posted July 17, 2006 thx guys, this gives me exactly what I need. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now