WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

DOS

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Sending Keystrokes, DOS Applications
and Blanked Screen

Keywords:	 sendkey keystroke key send  dos file function call  flashes black

Here are a few things to keep in mind when sending keystrokes to DOS apps:

Example:

	; start Notepad, and use *.* for filenames
	Run("notepad.exe", "")
	SendKey("!fo*.*~")
	; run DOS batch file which starts our editor
	Run("edit.bat", "")
	; wait 15 seconds for editor to load
	Timedelay(15)
	; send string (with carriage return) to the clipboard
	ClipPut("Hello%@crlf%")
	; paste contents of clipboard to DOS window
	SendKey("!{SP}ep")

In those cases where you have an application which can accept text pasted in from the clipboard, it will often be more efficient to use the ClipGet function:

	Run("notepad.exe", "")
	; copy some text to the clipboard
	ClipPut("Dear Sirs:%@crlf%%@crlf%")
	; paste the text into Notepad (using Shift-Ins)
	SendKey("+{INSERT}")
A WIL program cannot send keystrokes to its own WIL Interpreter window.

Note: If your SendKey statement doesn't seem to be working (eg., all you get are beeping noises), you may need to place a WinActivate statement before the SendKey statement to insure that you are sending the keystrokes to the correct window.

See Also:

ClipGet, SnapShot, WinActivate 

Pulling up the DOS Window Menu

Question:

In the following code:
	SendKey("!(SP)EP")   
 
everything works perfectly except no sendkey!

Answer:

The stuff around the SP must be the special curly braces rather than the normal parenthesis. Everything you mentioned sounds reasonable, but I failed to detect the required CURLY BRACES around the SP.

More info..............

    SendKey("!{SP}EP")
Actually the following will also work:
   SendKey("! EP")     ;<<<- when you just type a space for a space
Also as a point of nitpicking:
    SendKey("! EP") 
is the same as:
ALT SPACE SHIFTDOWN e p SHIFTUP.

However, I don't really think you're supposed to do it that way. So instead use the lower case example:

	SendKey("! ep")

How to Send a Backslash to a DOS Window

Question:

On my pc i have windows98 german version. I´m not capable to enter a backslash in a windowed dos box. The backslash is ignored in the SendKey command. The key combination to enter a "\" is "ALT-GR \". How can i enter a backslash in a windowed dos box?

Answer:

	Clipput("c:\temp\xyz.txt")
	SendKey("! ep") ; Alt space E P

Article ID:   W12902
Filename:   Sending Keystrokes to DOS Apps and Blanked Screen.txt
File Created: 1999:04:15:16:50:24
Last Updated: 1999:04:15:16:50:24