JS play a Play WSH bar _ basic knowledge

Source: Internet
Author: User
Windows Script Host (Windows Scripting Host) provides an ActiveX scripting engine with a language-independent script host. It allows scripts to run through the Windows Desktop or command line. It's convenient to do something that needs to be batched.
[Play a game] save the following code as Sendkeys.js, and then double-click to run it.
Copy Code code as follows:

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");

WSH itself is not a lot of content, if you can be a good foundation in 40 minutes within the basic grasp (that is, the tutorial to browse through).

Here is a Chinese tutorial, is left by the eyes of the ancestors of the things: Http://www.blueidea.com/user/qswh/WSH.CHM

This tutorial is older, and the new data is visible in http://msdn.microsoft.com/library/en-us/script56/html/d78573b7-fc96-410b-8fd0-3e84bd7d470f.asp

All that's left is to call the ActiveX component you need, which is also the main fun of Windows scripting. One of the reasons why ActiveX technology is not obsolete is its application in scripting.

In addition to direct scripting applications, WSH can also be embedded in other programs, and Delphi and VB (6.0) programs use regular expressions in this way.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.