Skip to content

Instantly share code, notes, and snippets.

@yu-tang
Created January 26, 2012 10:42
Show Gist options
  • Save yu-tang/1682187 to your computer and use it in GitHub Desktop.
Save yu-tang/1682187 to your computer and use it in GitHub Desktop.
CScript/WScript 環境の JScript 用ユーティリティ
/*
いちいち WScript... と書きたくないためだけのユーティリティ
*/
// echo() as WScript.Echo()
this.echo = function(){
var s = '',i, numargs = arguments.length;
for (i = 0; i < numargs; i++){
s += arguments[i];
}
WScript.Echo(s);
return(s);
};
// sleep() as WScript.Sleep()
this.sleep = function(intTime){
WScript.Sleep(intTime);
};
// scriptPath
this.scriptPath = WScript.ScriptFullName.slice(0, -WScript.ScriptName.length);
// test
var d = new Date();
echo(123,'abc', null,d);
echo('3秒Sleepします。');
sleep(3000);
echo('3秒Sleepしました。');
echo(scriptPath);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment