Code:
$oldServer = 'server1'
$newServer = 'server2'

$inifile = '.\test.ini'
;get an array of the sections
$sections = split(ReadProfileString($inifile,'',''),CHR(10))
redim preserve $sections[ubound($sections)-1] ;trim the array by one


for each $section in $sections
;get an array of the keys in a section
$keys = split(ReadProfileString($inifile,$section,''),CHR(10))
redim preserve $keys[ubound($keys)-1] ;trim the array by 1

for each $key in $keys
$data = ReadProfileString($inifile,$section,$key)

;if the data of a key has the old server int it, replace it with the new server name
If InSTR($data,$oldserver)
$data = join(split($data,$oldserver),$newserver)

;save data back to the ini file
$ = WriteProfileString($inifile,$section,$key,$data)
EndIf
next
next



Edited by Bryce (2005-08-09 09:27 PM)