FSO = WScript.CreateObject('Scripting.FileSystemObject');
File = FSO.GetFile('asciiman_orig.txt');
TextStream = File.OpenAsTextStream(1);
Result = '';
for(;!TextStream.AtEndOfStream;) {
    Result = Result + TextStream.ReadLine();
}
TextStream.Close();
aResult = Result.split(',');

//WScript.echo(aResult);

sResult = '.BYTE ';
strLen = 0;

for (i=0;i<aResult.length;i++) {
	gElement = aResult[i];
	if(isNumeric(gElement)) {

		sResult += gElement + '.,';
		strLen += 4;
		if (parseInt(gElement,10)==0){strLen = 0;sResult += '\r\n';}
	}
	else {
			sResult += (256 - gElement.length) + '.,';
			strLen += 4;
	}
	if(strLen>80) {strLen = 0; sResult += '\r\n'}

}

sResult += '0.';

//WScript.echo(sResult);

TextStream = FSO.CreateTextFile('asciiman_RND_res.txt');
TextStream.Write(sResult);
TextStream.Close();


function isNumeric(gValue) {
	if ('0123456789'.indexOf(gValue.substr(0,1))!=-1) return true;
	else return false;
}