Windows Script Host provides a language-independent script host for the ActiveX script engine. It allows running scripts from the Windows desktop or command line. It's very convenient for doing things that require batch processing.
[Have fun] Save the following code as sendkeys.js, and then double-click to run it.
var WshShell = new ActiveXObject("WScript.Shell") ;
WshShell.Run("Notepad");
WScript.Sleep(100);
WshShell.AppActivate("Notepad");
WScript.Sleep(100);
WshShell. SendKeys("Hello World!{ENTER}");
WScript.Sleep(500);
WshShell.SendKeys("^s");
WScript.Sleep(500);
WshShell. SendKeys("c:\savedWorld.txt");
WScript.Sleep(500);
WshShell.SendKeys("%s");
The content involved in WSH itself is not Not much. If you have a good foundation, you can basically master it within 40 minutes (that is, you have browsed through the tutorial).
Here is a Chinese tutorial, something left by Senior Qiushui:
http://www.blueidea.com/user/qswh/WSH.CHM This tutorial is relatively old, new information can be found at
http://msdn.microsoft.com/library/en-us/script56/html/d78573b7-fc96-410b-8fd0-3e84bd7d470f.aspThe rest is to call the ActiveX components you need, which is also the main fun of Windows Scripting. One of the things that future-proofs ActiveX technology is its use in scripts.
In addition to direct script applications, WSH can also be embedded into other programs. Delphi and VB (6.0) programs use regular expressions in this way.