Partager via


Simple ACA dumper

Quick one today – if you have an ACA with some files in it, you can use the createaca tool (provided as part of the Jumpstart Kit) to list the files inside it. Trouble is that the output is not very helpful; it contains too much information.

So here is a simple JScript file you can run on the output of createaca -r to just dump the filenames (and it checks for duplicates, too!). Just copy to dumpaca.js (or the file of your choice) and run it from a command prompt. It expects a file named filelist.txt to exist in the same folder. Modifications to do whatever you want to do should be trivial...

// Open file named "filelist.txt"
‎var fso = new ActiveXObject("Scripting.FileSystemObject");
var stream = fso.OpenTextFile("filelist.txt");
var contents = stream.ReadAll();

// Regular expression to search for DATA_FNAME followed by a name
var re =/DATA_FNAME : ((?:w|.)+)/g;

// Lists of result data
var names = {};
var nameList = [];
var result;
var dupes = [];

// Search for every instance of the regular expression
while(null != (result = re.exec(contents)))
{
var name = result[1];

  // Record dupes
if (names[name] != null)
{
dupes.push(name);
}
// else record new values
else
{
names[name] = nameList.length;
nameList.push(name);
}
}

// Print results
print("---------- Complete file list ----------");

for (var i in nameList)
print(nameList[i]);

// Print dupes
if (dupes.length > 0)
{
print("---------- Duplicate file names ----------");

  for (var j in dupes)
print(dupes[j]);
}

// Helper
function print(s) { WScript.Echo(String(s)); }