Jump to content
Server Maintenance This Week. ×

send keys


This topic is 6043 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Set WshShell = WScript.CreateObject("WScript.Shell")

WshShell.AppActivate "WindowName" 'Replace WindowName with the name of your window

WScript.Sleep 1000'wait

WshShell.SendKeys "sendthis{Enter}"

saved as .vbs

I don't suggest this unless the is no alternative. (almost always another way.)

a user can steal the focus from the script, Is very hard to capture errors. The sendkey command should only be used as a last resort. Having said that I have used it with some success. Depending on the enviroment it is running in and a important the script is, you can add alot to the script that can make it run more reliably but I have never done this and made it run flawlessly. (If I'm the only one running it, no problem)

Link to comment
Share on other sites

  • 1 month later...

This topic is 6043 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.