Bonjour,
Je travail sur un application qui, lors de son installation doit écrire dans un fichier XML.
Ce fichier se nomme: "dll.xml".
je dois y écrire une simple série de ligne que voici (écrites à la main):
Voici ce que j'ai essayé sans succès:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8 <Launch.Addon> <Name>CPS</Name> <Disabled>False</Disabled> <ManualLoad>False</ManualLoad> <Path>CPSModulesStart.dll</Path> </Launch.Addon>
Comment puis-je faire à partir de la section code de Inno Setup 5.3.3?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47 function NextButtonClick(CurPageID: Integer): Boolean; var XMLDoc, NewNode, NewName, NewDisabled, NewManualLoad, NewPath, RootNode: Variant; Path: String; begin if curpageID=wpReady then begin Path := ExpandConstant('{src}\'); { Load the XML File } XMLDoc := CreateOleObject('MSXML2.DOMDocument'); XMLDoc.async := False; XMLDoc.resolveExternals := False; XMLDoc.load(Path + XMLFileName); if XMLDoc.parseError.errorCode <> 0 then RaiseException('Error on line ' + IntToStr(XMLDoc.parseError.line) + ',position ' + IntToStr(XMLDoc.parseError.linepos) + ': ' + XMLDoc.parseError.reason); MsgBox('Loaded the XML file.', mbInformation, mb_Ok); { Modify the XML document } NewNode := XMLDoc.createElement('Launch.Addon'); RootNode := XMLDoc.documentElement; RootNode.appendChild(NewNode); NewName := XMLDoc.createElement('Name'); NewNode.appendChild(NewName); NewNode.LastChild.text:= 'CPS'; NewDisabled := XMLDoc.createElement('Disabled'); NewName.appendChild(NewDisabled); NewName.LastChild.text:= 'False'; NewManualLoad := XMLDoc.createElement('ManualLoad'); NewDisabled.appendChild(NewManualLoad); NewDisabled.lastChild.text:= 'False'; NewPath := XMLDoc.createElement('Path'); NewManualLoad.appendChild(NewPath); NewManualLoad.lastChild.text:='CPSModulesStart.dll'; { Save the XML document } XMLDoc.Save(Path + XMLFileName); MsgBox('Saved the modified XML as ' + XMLFileName, mbInformation, mb_Ok); Result:=True; end; Result:=True; end;
Merci de votre aide.
Cordialement
Pierre
Partager