inno セットアップのヘルプが必要です。いくつかの xml ノードを特定の行に保存する必要がありますが、方法がわかりません。
これは私のコードです
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 the software. ' +
// 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 the software', mbError, MB_OK);
end;
end;
function NextButtonClick(PageID: Integer): Boolean;
var
XMLFile: string;
begin
Result := True;
if (PageId = wpFinished) then
begin
XMLFile := ExpandConstant('{pf}\Hell\0\Config.xml');
if FileExists(XMLFile) then
begin
SaveValueToXML(XMLFile, '//@param', PEdit.Text); //PEdit.text is from a custom input text box in the installer, ignore.
SaveValueToXML(XMLFile, '//@path',
ExpandConstant('{reg:HKCU\SOFTWARE\Craps,InstallPath}\Test.exe'));
end;
end;
end;
これは私のXMLファイルです:
<?xml version="1.0" encoding="UTF-8"?>
<stuffs>
<stuff ident="555" path="C:\Program Files (x86)\Other thing\Other.exe" param="-alive" display="1" priority="0"/>
<stuff ident="666" path="C:\Program Files (x86)\Craps\test.exe" param="-dead" display="1" priority="0"/>
</stuffs>
問題は、私のスクリプトが常に最初の行に書き込むことです。私が必要とするのは、常に次の行にノードを保存することです<stuff ident="666"
前もって感謝します!