Questions? Search our site or call us at 1-800-722-6004

Sending Keystrokes to a DOS Window with WinWedge

Although it is technically not possible for a Windows program to send keystrokes directly to a DOS application running in a DOS window, there is a way to cheat and get Windows to do the job for us. An interesting feature of Windows is that it supports the ability to "Cut and Paste" data between DOS and Windows programs using the Windows clipboard. In order to get WinWedge to send data to a DOS application in a DOS window you first have to send the data as keystrokes to a Windows program and then send additional keystrokes that first "cut" the data from the Windows application, switch the focus to the DOS window and finally "paste" the data into the DOS window.

To try this technique, configure WinWedge in "Send Keystrokes" mode specifying the NotePad program as the target for all keystrokes from WinWedge. Next, configure WinWedge to work with your serial device and then add the following characters to the end of the "Field Postamble Keystrokes" for the very last data field that you have defined in WinWedge:

%ea^x%{TAB}%{ }ep

Finally, open a DOS session in a window (not full screen) and transmit some data from your device.

The data should first pop into the NotePad program and then be cut from NotePad and pasted into the DOS window.

The keystrokes: "%ea" mean "Alt+e a" which causes the NotePad program to select all the text in the NotePad Window. The keystrokes: "^x" mean "Ctrl+x" which causes NotePad to cut the currently selected text to the clipboard. The keystrokes: "%{TAB}" mean "Alt+Tab" which causes Windows to switch the focus to the last window that was active before the NotePad program received the focus (i.e. the DOS window). Finally the keystrokes: "%{ }ep" mean "Alt+space e p" which opens the control box in the DOS window and selects "Edit" and "Paste".

The next time you transmit a data record from your device, WinWedge switch the focus back to the NotePad application automatically and do the same thing all over again. If you have a reasonably fast PC you will barely notice the NotePad program popping open in front of your DOS window.

If you find that, after the text is cut from Notepad, focus is returned to WinWedge rather than to the DOS Window, try using the following sequence as a postamble:

%ea^x%({TAB}{TAB})%{ }ep%({TAB}{TAB})

The difference here is that it holds down the alt key and tabs twice (from Notepad to WinWedge to the DOS Window, then after pasting in the data it 'alt tabs' twice back to Notepad).

Note: A true DOS version of the Software Wedge is available that may be better suited for passing data to a DOS application program. The Software Wedge for DOS is a RAM resident (TSR) program that passes serial data directly to other DOS programs by stuffing the DOS keyboard buffer. Although it is a DOS application, it runs extremely well in Windows inside a DOS Window and is an excellent tool for passing serial data to other DOS based programs.


Categories: Tutorial / How-To, WinWedge

Last Updated: 2011.07.08

Need more help?

Don't hesitate to call or email us with your questions

Our office is open 9AM - 5PM Monday Through Friday (E.S.T.)

Technical Support: 215-496-0202

Toll-Free: 1 (800) 722-6004
Skype: taltech1 (Voice only)
Email: support@TALtech.com