• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 489
  • Last Modified:

vbscript to send charactors to an existing running program

I need to send charactors to a program that is running called DBC.EXE so that it will gracefully exit when a user logs out but forgets to close the program correctly.

I need to send ESC 3 times, with a pause each time, then send the Y charactor.

I have little to no VBscript  experiance and any help would be greatly appriciated.
0
Darkstriker69
Asked:
Darkstriker69
1 Solution
 
cupCommented:
Have a look at the help for sendkeys.

It will be something like

pauseperiod = 5000 ' time in milliseconds
set objShell = CreateObject ("WScript.Shell")
objShell.AppActivate "DBC.exe"  ' whatever it says on the title bar
objShell.SendKeys "{ESC}"
WScript.Sleep pauseperiod
objShell.SendKeys "{ESC}"
WScript.Sleep pauseperiod
objShell.SendKeys "{ESC}"
WScript.Sleep pauseperiod
objShell.SendKeys "Y"
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now