Skip to content

Instantly share code, notes, and snippets.

@katai5plate
Last active February 28, 2020 11:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save katai5plate/d7d0eaeea51d1eec74537bf82571fc05 to your computer and use it in GitHub Desktop.
Save katai5plate/d7d0eaeea51d1eec74537bf82571fc05 to your computer and use it in GitHub Desktop.
10秒ごとに任意のキーが自動的に押されることで強制スリープを回避したいときのバッチ
rem = 0 /*
:repeat
timeout 10
cscript %~n0%~x0 //E:jscript
goto repeat
rem */
var shell = WScript.CreateObject("WScript.Shell");
switch(Math.floor(Math.random() * 6)){
case 0: shell.sendKeys("{DOWN}"); break;
case 1: shell.sendKeys("{UP}"); break;
case 2: shell.sendKeys("{LEFT}"); break;
case 3: shell.sendKeys("{RIGHT}"); break;
case 4: shell.sendKeys("{PGDN}"); break;
case 5: shell.sendKeys("{PGUP}"); break;
// for VSCode
// case 6: shell.sendKeys("^{PGDN}"); break;
// case 7: shell.sendKeys("^{PGUP}"); break;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment