[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 var debug=true; 2 3 var oShell = WScript.CreateObject("WScript.Shell"); 4 var NetinstDir = oShell.ExpandEnvironmentStrings("%SystemDrive%\\netinst"); 5 var fso = new ActiveXObject("Scripting.FileSystemObject"); 6 7 //var poste = oShell.ExpandEnvironmentStrings("%ComputerName%").toLowerCase( ); 8 var Z = oShell.ExpandEnvironmentStrings("%Z%"); 9 10 var xslPath = Z + "\\wpkg\\AnalyseCategory.xsl"; 11 var xmlPath = Z + "\\wpkg\\packages.xml"; 12 var xmlResultPath = NetinstDir + "\\PackagesCategory.txt"; 13 14 var ansichar = Array(); 15 var ansiStr0 = ""; 16 //var ansiStr = "׃Ѫ++++--+-+++---+i++_̯յݯ="; 17 var ansiStr = "__'" + '"' + ".^%S<O_Z__''" + '"' + "" + '"' + " --~Ts>o_zYϾǎԐѥ噞ᅠƄФ"; 18 19 for (i=0; i<128; i++) { 20 //if (i>0) alert((i+128) + "=" +String.fromCharCode(i)+ " : " + ansi[i] + " = " + String.fromCharCode(ansi[i]) ); 21 ansichar[ansiStr0.charAt(i)] = ansiStr.charAt(i); 22 } 23 // WScript.Echo("poste=" + poste); 24 // WScript.Echo("xslPath=" + xslPath); 25 // WScript.Echo("xmlPath=" + xmlPath); 26 27 main(WScript.Arguments); 28 29 function main(argv) { 30 // TODO : vrifier que le xmlPath existe. 31 32 //xmlResultDoc = new ActiveXObject("Msxml2.DOMDocument"); 33 xmlDoc = new ActiveXObject("Msxml2.DOMDocument"); 34 xmlDoc.async = false; 35 xmlDoc.load(xmlPath); 36 var xslt = new ActiveXObject("Msxml2.XSLTemplate"); 37 38 var xslDoc = new ActiveXObject("Msxml2.FreeThreadedDOMDocument"); 39 var xslProc; 40 xslDoc.async = false; 41 xslDoc.load(xslPath); 42 43 xslt.stylesheet = xslDoc; 44 xslProc = xslt.createProcessor(); 45 xslProc.input = xmlDoc; 46 //xslProc.output = xmlResultDoc; 47 48 //xslProc.addParameter("poste", poste); 49 50 xslProc.transform(); 51 52 SauveFichier(xmlResultPath, xslProc.output) 53 //xmlResultDoc.save(xmlResultPath); 54 55 //WScript.Echo(xslProc.output) 56 } 57 function SauveFichier(filespec, texte) { 58 var f, s; 59 f = fso.OpenTextFile(filespec, 2, true, 0); // ForWriting 60 try { 61 f.Write(ansi2oem(texte)); 62 } catch (e) { 63 info("Erreur "+e+" SauveFichier filespec=" + filespec + "\ntexte=" + texte + "\n" + e.description); 64 return e; 65 } 66 f.Close(); 67 return; 68 } 69 function ansi2oem(Texte) { //Conversion ANSI -> OEM 70 var i, s = "", L, c; 71 L = Texte.length; 72 for (i=0; i<L; i++) { 73 c = Texte.charCodeAt(i); 74 if ( Texte.charCodeAt(i) >= 128 ) { 75 s += ansichar[Texte.charAt(i)]; 76 } else { 77 s += Texte.charAt(i); 78 } 79 } 80 return s; 81 } 82 function dinfo(stringInfo) { 83 if (debug) { 84 info("Dbg: " + stringInfo) 85 } 86 } 87 function info(message) { 88 WScript.Echo(message); 89 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Tue Mar 17 22:47:18 2015 | Cross-referenced by PHPXref 0.7.1 |