Window keystrokes1/31/2024 ![]() Similarly, if you wanted to send a phrase, you’d use the format: For example, if you wanted to send the single character z, you’d use the format: Sending any of the standard characters on the keyboard is just a matter of enclosing the characters in quotes as a string. In this case, WshShell is the standard Windows Script Host Shell object variable that you need to instantiate at the beginning of every script, and string is the keystroke that you want to send to the application. Fortunately, the syntax for the SendKeys method is very straightforward: It’s an executable installation file, which will install a compiled Help file.īefore you can begin using the SendKeys method to create macros, you need to have a grasp of its syntax. (Keep in mind that there are two versions of the package, one for Windows 2000 and one for Windows 98/ME and Windows NT 4.0.) While you’re there, make sure that you also download the Windows Script Host 5.6 Documentation. Just follow the link to the Windows Script 5.6 Download section. You can download the Windows Script Host 5.6 package from the Windows Script portion of Microsoft’s MSDN Library site. Windows Script Host 5.6 is built into Windows XP, but if you’re using Windows 98/ME or Windows 2000, you’ll definitely want to upgrade to the most recent version to take advantage of all the latest improvements. Windows XP comes with Windows Script Host 5.6, which, like its predecessor, includes the SendKeys method.ĭownloading the Windows Script Host package The SendKeys method provides you with a very easy-to use, macro-like tool, and best of all, it’s built right into the Windows operating system. While SendKeys is limited to the keyboard, keep in mind that you can use the keyboard to manually perform many of the operations you normally perform with the mouse. As the name implies, the SendKeys method is designed to allow you to send any keystrokes you can imagine from within a script to an active window just as if they were typed from the keyboard. When Microsoft introduced Windows Script Host 2.0 in 1999, they included a new method in the object model called SendKeys. To learn about the history of native macro capability, click here. To conclude, I’ll show you how to bypass one of the biggest complaints IT pros have against using the SendKeys method. In this Daily Drill Down, I’ll explain in detail how the SendKeys method works, and I’ll show you how to create a SendKeys macro to automate repetitive tasks. Programming the SendKeys method is relatively easy once you understand its rules and how to use it, and it can literally save you hours of time that you used to spend performing repetitive tasks. Hidden deep within the Windows Script Host’s object model is a small but powerful method called SendKeys that allows you to send keystrokes to the active window just as if you had manually typed them on the keyboard.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |