WScript.Echo("JScript interpretator"); WScript.Echo("====================="); WScript.Echo("(c)2000 O.Mihailik\n"); WScript.Echo("type 'exit()' to finish.\n\n"); var FS=new ActiveXObject("Scripting.FileSystemObject"); var console=FS.OpenTextFile("con"); var Finish=false; var command; var Shell=new ActiveXObject("Wscript.Shell"); var Network=new ActiveXObject("Wscript.Network"); function JSstring(str) { str=String(str); var result=""; for( var i=0; i<str.length; i++ ) { if( str.substr(i,1)=="\n" ) { result+="\\n"; i++; }; else if( str.substr(i,1)=="\r" ) result+="\\r"; else if( str.substr(i,1)==">" ) result+="\\076"; else if( str.substr(i,1)=="\"" ) result+="\\\""; else if( str.substr(i,1)=="\'" ) result+="\\'"; else result+=str.substr(i,1); }; return result; }; function exit() { Finish=true; }; while( !Finish ) { var command=console.ReadLine(); while( command.substr(command.length-1)=="_" ) { command=command.substr(0,command.length-1); command+="\n"+console.ReadLine(); }; var result; try { with( WScript ) with( Math ) with ( Shell ) with ( Network ) with ( FS ) result=eval(command); if( result!=null ) WScript.Echo(" ="+String(result)); WScript.Echo(" O.K.\n"); } catch(error) { WScript.Echo(" ERROR:\b"); WScript.Echo(" "+error.description+"\n"); }; }; |