|
utiliser des fichiers.js
|
Thread Tools | Display Modes |
|
|
|
#5
|
||||
|
||||
|
Re: utiliser des fichiers.js
pas du tout, il est fait pour être exécuté, le voila :
Code:
// Constants
var ForAppending = 8,
ForReading = 1,
ForWriting = 2;
// Objects
var fso = WScript.CreateObject("Scripting.FileSystemObject"),
shell = WScript.CreateObject("WScript.Shell");
// Functions
function GetFolderFilesAsArray(path){
var f = fso.GetFolder(path),
fc = new Enumerator(f.files),
s = [];
for (; !fc.atEnd(); fc.moveNext()) s.push(path + "\\" + fso.GetFile(fc.item()).Name);
return(s);
}
// Variables
var files = GetFolderFilesAsArray("_SOURCE"),
folder_in = "_IN",
folder_log = "logs",
folder_out = "_OUT",
folder_res = "resources",
i,
itm,
itm_name,
j,
k,
l,
o,
rcfile,
rcstream,
rctxt,
reshacker = "tools/ResHack/ResHacker.exe",
reslang = "",
res = ["AVI", "BITMAP", "CURSORGROUP", "ICONGROUP"],
scriptfile,
ln;
// EXTRACT RESOURCES & GENERATE RESHACKER SCRIPTS
if (files.length) {
if (fso.FileExists(reshacker.replace(/\//g,"\\"))) {
WScript.StdOut.Write("EXTRACTING RESOURCES...\n\n");
for (i=0; i<files.length; i++) {
itm = files[i];
if (itm) {
o = itm.lastIndexOf("\\");
itm_name = o >= 0 ? itm.substr(o+1) : itm;
WScript.StdOut.Write("Extracting resources from "+itm_name+"...");
if (fso.FolderExists(folder_res+"\\"+itm_name)) {
fso.DeleteFile(folder_res+"\\"+itm_name+"\\*", true);
}
else fso.CreateFolder(folder_res+"\\"+itm_name);
scriptfile = fso.OpenTextFile(folder_res+"\\"+itm_name+"\\script.txt", ForWriting, true);
scriptfile.WriteLine("[FILENAMES]");
scriptfile.WriteLine("Exe = \""+folder_in+"\\"+itm_name+"\"");
scriptfile.WriteLine("SaveAs = \""+folder_out+"\\"+itm_name+"\"");
scriptfile.WriteLine("Log = \""+folder_log+"\\"+itm_name+".log\"");
scriptfile.WriteLine("");
scriptfile.WriteLine("[COMMANDS]");
for (j=0; j<res.length; j++) {
shell.Run(reshacker+" -extract \""+itm+"\", \""+folder_res+"\\"+itm_name+"\\"+res[j]+".rc\", "+res[j]+",,"+reslang, 0, true);
if (!fso.FileExists(rcfile = folder_res+"\\"+itm_name+"\\"+res[j]+".rc")) continue;
rcfile = fso.GetFile(rcfile);
if (rcfile.size > 0) {
rcstream = rcfile.OpenAsTextStream(ForReading);
rctxt = rcstream.ReadAll().replace(/\r/g,"\n").split("\n");
rcstream.Close();
for (k=0; k<rctxt.length; k++) if (ln = rctxt[k]) {
ln=ln.split(" ");
if (ln[1]=="ICON") ln[1]="ICONGROUP";
else if (ln[1]=="CURSOR") ln[1]="CURSORGROUP";
scriptfile.WriteLine("-modify \""+folder_res+"\\"+itm_name+"\\"+ln[2].split("\"").join("")+"\", "+ln[1]+","+ln[0]+","+reslang);
}
}
}
WScript.StdOut.Write("done.\n");
scriptfile.Close();
}
}
WScript.StdOut.Write("\nRESOURCES EXTRACTED.\n");
}
else {
WScript.StdOut.Write("ERROR: Resource Hacker not found!\nResource Hacker needs to be in tools\\ResHack.\nNO RESOURCES EXTRACTED.\n");
}
}
else {
WScript.StdOut.Write("ERROR: No resources to extract.\n");
}
// EOF
__________________
[01mai2004@11:23:54] <@Kaspof> je garderais toujours un souvenir impérissable de toi LeMoi|Vacances Ne soyez pas un boulet ! |
| Bookmarks |
«
Previous Thread
|
Next Thread
»
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Comment utiliser l'accès ADSL wanadoo sans l'interface wanadoo ? | USA Mike | Internet, Réseaux et Sécurité | 14 | 13-09-2004 20:13 |
| Comment utiliser ATI Tool ? | Toitoine | Actualité | 2 | 12-08-2004 18:55 |
| Utiliser la recherche classique de Windows | Cougar | Astuces | 7 | 01-06-2004 22:12 |
| Le choc : Linux peut utiliser les pilotes de Windows ! | Benjy | Actualité | 4 | 26-10-2003 09:40 |
| Comment obliger Windows 2000 à utiliser une IRQ par carte ? | Benjy | Astuces | 0 | 05-10-2003 14:40 |
All times are GMT +2. The time now is 05:24.
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.





























Threaded Mode

