Here's what I am trying to do. I have a text file that has a URL path and a destination path. Based on what OS, I'd like it to automatically change the destination path in the file. Here is the code I am trying to use.

Code:

Function Change_Text

$sMyFile = @SCRIPTDIR + '\xfer.txt'

If Exist($sMyFile)

$sOldString1="%" + "windir" + "%"
Select
Case InStr(%windir%,"\Windows")
$sNewString= %systemdrive% + "\Windows"
Case InStr(%windir%,"\WinNT")
$sNewString= %systemdrive% + "\WinNT"
Case 1
$sNewString = %systemdrive% + "\Temp"
EndSelect

$msg = MessageBox("Old string = " + $sOldString1 + @CRLF +
"New string = " + $sNewString,"Notice",64)

Exit

For Each $sSection in Split(ReadProfileString($sMyFile,"",""),Chr(10))
If $sSection
; "Checking section "+$sSection+@CRLF
For Each $sEntry in Split(ReadProfileString($sMyFile,$sSection,""),Chr(10))
If $sEntry
$sValue=ReadProfileString($sMyFile,$sSection,$sEntry)
; "Entry "+$sEntry+" has value "+$sValue+" status:"
If $sValue=$sOldString1; Or $sValue=$sOldString2 Or $sValue=$sOldString3
; " **UPDATED**"+@CRLF
$=WriteProfileString($sMyFile,$sSection,$sEntry,$sNewString)
Else
; " No change"+@CRLF
EndIf
EndIf
Next
EndIf
Next
EndIf

EndFunction



Here is the text file http://upload.dataspike.org/files/1/xfer.txt (right click, save-as)

However, when I run the function it doesn't do anything. I know the commands are based off of using an INI type format with sections and what not, but with this file being read by an external application, I can't have any of those sections, it has to be formatted exactly as it is.

Any help, and or suggestions would be awesome!

Thanks,
Chris