View Full Version : wshshell.sendkeys
loicromer
07-04-2001, 04:58 AM
I would like to know if it is possible to send some keys to an other programe than notepad.
RWSchlatter
07-05-2001, 04:28 AM
Yes. Many samples use Notepad cause it is a simple application that everyone has, but that is no restriction (eg a sample in the WSH Help file uses the Calculator calc.exe).
The SendKeys data is always directed to the top (active) window, the same as if you would be typeing at your keyboard.
The difficulty with using SendKeys is, that you must be sure about the current state of the application you are addressing. The best way is, to once type in everything at the keyboard and write down every step you make. Rather than using the mouse to invoke menu items, use menu shortcuts. And remember the sometimes less used keystrokes, like Alt to activate the menu line, the move-left /-right /-up /-down keys to navigate etc.
______________
Regards - Richard
tHE DSS
07-08-2001, 12:51 AM
Might be a little too late here, but hey, why not add it anyway.
There is a method in the "shell" object that goes by the name of "AppActivate "<prog name>".
With this method, you can choose which application becomes active, i.e. which application the "SendKeys" method works with.
To fix the still remaining problem of, "you can never trust the user not to go clicking and changing window focus", you could implement a function that contains the "AppActivate" method, and call this function every half a second or so - if your script will allow this.
Powered by vBulletin™ Version 4.1.0 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.