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

Sending Data as Keystrokes to More than One Application at a Time

In a previous example we showed how to send data from WinWedge to a DOS application by first sending the data as keystrokes to the NotePad program and then cutting the data out of NotePad, switching the focus to a DOS window and pasting the data in. You can use the same technique to have WinWedge send data to two (or more) Windows or DOS programs at a time. For example, if in the previous example we were to copy the data from NotePad instead of cutting the data, we would end up with both the NotePad and the DOS programs receiving the data.

All you need to do to pass data to two Windows programs is to send the data to the first application and then use whatever keystrokes are necessary to copy the data to the clipboard, switch the focus to the second application and finally paste the data in. Even if neither of the applications provides an explicit copy or paste function, you can always copy text to the clipboard in any Windows program by first selecting the text and issuing the keystroke Ctrl+Insert (or Ctrl+C). In a "Field Postamble Keystroke" macro in WinWedge, Ctrl+Insert is represented by: ^{INSERT}. Likewise, you can paste text data from the clipboard into any Windows program using the keystrokes Shift+Insert (or Ctrl+V). In WinWedge Shift+Insert is represented by: +{INSERT}. To select text in any program you can hold down the shift key while using the arrow keys, Home, End, Page Up and Page Down keys to highlight and select characters.

Windows will also switch the focus between all running application when you hold the Alt key down and press the Tab key. Windows maintains a list of all currently running applications with the application that currently has the input focus placed at the top of the list. If you switch to another application, the new application moves to the top of the list and the previously active application moves down one spot in the list. When hold the ALT key down, each time you press the tab key, Windows moves down the list one item and selects the application at that position in the list. When you release the Alt key, the selected application is given the focus and is moved to the top of the list pushing all other application that were above it in the list down one spot.

For example, if you had WinWedge set up to send keystrokes to NotePad and you also wanted to send the data to the WordPad you could use the following procedure:

Set up 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:

+({LEFT}{HOME})^{INSERT}{DOWN}%{TAB}+{INSERT}

Activate WinWedge and then launch the WordPad program followed by the NotePad program. At this point NotePad has the focus and is therefore at the top of the Window list with the WordPad program directly underneath it. When you input data from your device, it will be sent to both NotePad and WordPad. The keystrokes: +({LEFT}{HOME}) means hold the shift key while pressing the left arrow and the home key. This selects all text in the current line. The keystrokes: ^{INSERT} means Ctrl+Insert and causes all selected text to be copied to the clipboard. The {DOWN} keystroke that follows is there to simply de-select the currently selected text. The keystrokes: %{TAB} means Alt-Tab and causes Windows to switch the focus to the WordPad program. Finally, the keystrokes: +{INSERT} means shift+insert and performs the job of pasting the data from the clipboard into the WordPad program.

To send the data to three Windows programs at a time you could use the following "Field Postamble Keystrokes":

+({LEFT}{HOME})^{INSERT}{DOWN}%{TAB}+{INSERT}%{TAB 2}+{INSERT}


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