Hallo, ich habe folgende Text in einer XML Datei
[autoit]
<Feature Id="SetupControllerFiles" Cost="1248">
<OptionRef Id="AlwaysInstalled"/>
</Feature>
<Feature Id="SetupXmlFiles" Cost="1248">
<OptionRef Id="AlwaysInstalled"/>
</Feature>
Nun würd ich gern
<Feature Id="SetupXmlFiles" Cost="1248">
<OptionRef Id="AlwaysInstalled"/>
</Feature>
mit
<Feature Id="SetupXmlFiles" Cost="1248">
<OptionRef Id="neverInstalled"/>
</Feature>
ersetzen.
Folgendes Script Funtioniert leider nicht, ich vermute es liegt an der formatierung der zeile
[autoit]
$szFile= "C:\Program Files (x86)\Common Files\microsoft shared\OFFICE12\Office Setup Controller\Proof.en\Proof.xml"
$szText= FileRead($szFile,FileGetSize($szFile))
$mytext='<Feature Id="SetupXmlFiles" Cost="1248"><OptionRef Id="AlwaysInstalled"/>'
$mytextNew= '<Feature Id="SetupXmlFiles" Cost="1248"><OptionRef Id="neverInstalled"/>'
$szText= StringReplace($szText,$myText,$myTextNew)
MsgBox(4096,"Test", "text: " & $sztext)
[/autoit][autoit][/autoit][autoit]MsgBox(4096,"Test", "text: " & $mytext)
MsgBox(4096,"Test", "new: " & $mytextnew)