/* * JavaScript Windows ScriptingHost file * usage: cscript jsUART.js * cscript jsUART.js * * warning:- * cscript jsUART.js * Input Error: There is no script engine for file extension ".txt". * */ /* * ideas:= the files have gott too big so split up. Use copy to combine start , middle, end */ /* do.bat ================ rem rem rem rem cscript rem pause REM cscript jsUART.js dir /b U*.htm > op.txt pause cscript jsUARTsplit.js call do_filename.bat rem copy op1.txt+op2.txt+op3.txt joined.htm pause */ /* * split file * */ function ReadFileList( ){ var fso = new ActiveXObject("Scripting.FileSystemObject"); var i = 0 var ForReading = 1, ForWriting = 2, ForAppending = 8; var filename // stdout.WriteLine( filename ) // Open the file for input. fdir = fso.OpenTextFile("op.txt", ForReading); if ( fdir ){ while ( !fdir.AtEndOfStream ){ ipStr = fdir.ReadLine(); filename = ipStr.substring(0,ipStr.length-4) stdout.WriteLine( filename ) ReadSamples( filename ); } fdir.close() } } function ReadSamples( filename ){ var fso = new ActiveXObject("Scripting.FileSystemObject"); var i = 0 var ForReading = 1, ForWriting = 2, ForAppending = 8; stdout.WriteLine( filename ) // Open the file for input. f = fso.OpenTextFile(filename+".htm", ForReading); if ( f ){ var ipStr = ""; var want = ( 1==0 ); line=1; var fop = fso.OpenTextFile("do_filename.bat", ForAppending, true); if ( fop ){ // Write to the file. fop.WriteLine( "copy s_"+ filename+".txt + m_"+filename+".txt + e_"+filename+".txt " +" j_"+filename+"_joined.htm" ); fop.WriteLine( "copy s_"+ filename+".txt + e_"+filename+".txt " +" jt_"+filename+"_joined.htm" ); fop.close(); } var fop = fso.OpenTextFile("s_"+filename+".txt", ForWriting, true); if ( fop ){ // Write to the file. // fop.WriteLine("\n"); } while ( !f.AtEndOfStream ){ ipStr = f.ReadLine(); /* split */ if ( ipStr.match("") ) { if ( fop ){ fop.close(); fop = fso.OpenTextFile("e_"+filename+".txt", ForWriting, true); } } if ( fop ){ fop.WriteLine( ipStr ); } /* split */ if ( ipStr.match("