I was experimenting with a copy of Rick's stats.js and noted two new objects that weren't found when a whole staff was copied to the clipboard. On it's staff via the F2 key, the instrument (acoustic guitar) had a -12 specified for transposition.
/*
NWC2 User Tool, Ver 1.0 - Rick G. Warren's test version
JScript version of nwswStatisticsReport.php
&Command: WScript Scripts\Stats.js
*/
var i, mark = new Date(), s;
/*
objArgs = WScript.Arguments
WScript.Echo("Argument count = " + WScript.Arguments.Count());
for (i=0; i<objArgs.length; i++)
{
WScript.Echo(objArgs(i))
}
*/
// convert notation clip text to an array of lines
var stdin = WScript.StdIn.ReadAll().split("\r\n");
// init these so they will always report
var d = {"Total Items":0, "Clef":0, "Key":0, "TimeSig":0, "Bar":0, "Note":0, "Chord":0};
// count objects. non-objects are counted as 'undefined'
for (i in stdin){ // i = array index (integer)
s = stdin[i].split("|")[1]; // objType or undefined
if ((s == "Fake") || (s == "Context")) WScript.echo(i + " " + stdin[i]); // new line
d[s] = (0 | d[s]) + 1; // increment, create keys as needed
}
delete d.undefined; s = ""; // cleanup
for (i in d) d["Total Items"] += d[i];
for (i in d) s += (" " + d[i] + " ").slice(-6) + i + "\n";
// report to STDOUT, elapsed time to STDERR
WScript.StdOut.Write("Statistics Report:\n\n" + s);
WScript.StdErr.Write("The STDOUT file contains the report.\n" +
((new Date() - mark) / 1000).toFixed(2) + " seconds\n");
WScript.Quit(99); // show STDOUT page to user
Does anyone have any insight to these lines (they occurred just after the header) or others? The Fake line went away if there was no transposition.