Skip to content

Instantly share code, notes, and snippets.

@keimina
Last active December 30, 2015 07:39
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 keimina/7797064 to your computer and use it in GitHub Desktop.
Save keimina/7797064 to your computer and use it in GitHub Desktop.
[js]
//Be careful. It seems completely emulate key press.
//You need Execel app to run this code.
var shellApp = new ActiveXObject("Wscript.Shell");
var ex = WScript.CreateObject("Excel.Application");
shellApp.appActivate("C:\\Windows\\system32\\cmd.exe")
ex.ExecuteExcel4Macro("CALL(\"user32\",\"keybd_event\",\"JJJJJ\",164,56,1,0)");
ex.ExecuteExcel4Macro("CALL(\"user32\",\"keybd_event\",\"JJJJJ\",32,57,1,0)");
ex.ExecuteExcel4Macro("CALL(\"user32\",\"keybd_event\",\"JJJJJ\",32,57,3,0)");
ex.ExecuteExcel4Macro("CALL(\"user32\",\"keybd_event\",\"JJJJJ\",164,56,3,0)");
shellApp.sendKeys("ep");//Pasting clipboard text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment