I want the installer to edit a xml file in silence, without promp messages, that if the xml file exist in destination location, the installer edit it, and if do not exist in destination location, the installation continue and ignore that the xml file do not exist without prompt message. I saw the CodeAutomation.iss but that do not help me. Please help with a code sample.
[Files]
Source: GameConfiguration.xml; DestDir: "{pf}\Game\Sala"; Flags: uninsneveruninstall;
procedure SaveValueToXML(const AFileName, APath, AValue: string);
var
XMLNode: Variant;
XMLDocument: Variant;
begin
XMLDocument := CreateOleObject('Msxml2.DOMDocument.6.0');
try
XMLDocument.async := False;
XMLDocument.load(AFileName);
if (XMLDocument.parseError.errorCode <> 0) then
MsgBox('Install Garena. ' +
XMLDocument.parseError.reason, mbError, MB_OK)
else
begin
XMLDocument.setProperty('SelectionLanguage', 'XPath');
XMLNode := XMLDocument.selectSingleNode(APath);
XMLNode.text := AValue;
XMLDocument.save(AFileName);
end;
except
MsgBox('Install Garena', mbError, MB_OK);
end;
end;
function NextButtonClick2(PageID: Integer): Boolean;
begin
Result := True;
if (PageId = wpFinished) then begin
SaveValueToXML(ExpandConstant('{pf}\Game\Sala\GameConfiguration.xml'), '//@param', PEdit.Text);
SaveValueToXML(ExpandConstant('{pf}\Game\Sala\GameConfiguration.xml'), '//@path', ExpandConstant('{reg:HKCU\SOFTWARE\xxx,InstallPath}\xxx.exe'));
end;
end;