Copy and Paste Routine

 

This example demonstrates how to copy text from one application and paste it into another. It may be tempting to use the ALT+TAB key to switch between programs. This is actually not always reliable and in fact will not even work via Keyboard Express on some computers due to the low level nature of this key command. The solution is to use the ACTIVATE command.
 

Setting up the HotKey 

Create a new macro by clicking on Macro > New Macro. Press CTRL+ALT+F to select this hotkey and enter "Copy and Paste" into the nickname field, to provide a reminder as to what this macro does. Click OK to open the Keyboard Express - Editor window.
 

Writing the Macro 
Activate and copy from notepad

Double click on the Activate/Launch command located in the list of commands. From the Activate/Launch Program window that appears, select the Window Activate option. Enter notepad in the Window Title field and click on the OK button. This first step activates the notepad window so that it is ready to accept keystrokes.
 
To ensure that the macro doesn't start processing the next command before notepad has focus, double click on the Wait command. Select the Wait for Window Title to Appear option and enter notepad as the Window Title. Click OK to save. This instructs the macro to wait until notepad has focus and is ready to accept keystrokes.
 
The next step is to enter the commands to be processed in notepad. This example will repetitively copy one line at a time from notepad to wordpad. To do this, line one of the text needs to be highlighted. This can be done by using Shift+End. In the yellow area of the Editor, click on Shift and then click on End. Or manually type <SHIFT><END>.
 
The next step is to copy the highlighted text to the clipboard. Double click on the Clipboard command to open the Clipboard Copy window. Select the Clipboard Copy option and press OK to insert <CLIPBOARD COPY/> into the script.

 

Activate and paste into Wordpad 
Now that the line has been copied to the clipboard, the text is ready to be pasted into Wordpad. But first, move the cursor to the next line in notepad, so that the next line of text is ready to be copied. Click on Home and Arrow Down from the yellow area of the Keyboard Express - Editor. Or manually type <HOME><DOWN ARROW> into the Enter Keystrokes edit field.
 
Now to activate Wordpad, follow the same process as before by double clicking on the Activate/Launch command. Select Window Activate, enter wordpad as the Window Title and click the OK button. This action activates Wordpad and sends the text cursor to this program.
 
Again, to make sure that the macro doesn't start processing the next command before Wordpad has focus, double click on the Wait command. Make sure the Wait for Window Title to Appear option is selected. Enter wordpad as the Window Title and click OK. This instructs the macro to wait until Wordpad has focus and is ready to accept keystrokes.
 
The next step is to issue the paste command. Double click on the Clipboard command. Select the Clipboard Paste command from the drop down menu and click OK to insert <CLIPBOARD PASTE/> into the script.

 
Place an <ENTER> into the macro to move the cursor to a new line in Word. To do so, just click on Enter from the list of keys.

 

Setting up the Repeat Loop

Before finishing, there is one final issue to address. The macro needs to be placed in a loop so that it will copy more than just a single line of text.
 
This example will copy the first 5 lines of text in notepad over to Wordpad. To do so, place the cursor to the beginning of the macro script text. Then double click on the Repeat command located in the list of commands. The Start Repeat option should be selected. Enter 5 into the Number of Times to Repeat field and click OK to save.
 
Now place the cursor at the end of the macro text and double click on the Repeat command. In the Repeat window select the End Repeat option and click OK to save. All of the commands between the Start Repeat and End Repeat commands will be repeated five times.
 

Macro Script and Saving the Macro
The resulting macro should appear as follows:

 

<REPEAT START Count="5"/>

<WINDOW ACTIVATE Title="notepad" Exact_Match="FALSE" Wildcards="FALSE"/>

<WAIT FOR WINDOW TITLE Title="notepad" Partial="TRUE" Wildcards="FALSE" Indefinite="TRUE" Hours="0" Minutes="0" Seconds="0"/>

<SHIFT><END><CLIPBOARD COPY/><HOME><ARROW DOWN><WINDOW ACTIVATE Title="wordpad" Exact_Match="FALSE" Wildcards="FALSE"/><WAIT FOR WINDOW TITLE Title="wordpad" Partial="TRUE" Wildcards="FALSE" Indefinite="TRUE" Hours="0" Minutes="0" Seconds="0"/>

<CLIPBOARD PASTE/>

<ENTER><END REPEAT/>
 
Click on the Save and Close button to save the macro and return to the Keyboard Express - Explorer window. The new macro is displayed in the list of existing macros.
 
Testing the Macro
First minimize Keyboard Express. Then run notepad and Wordpad. (Click on the Start button of the desktop, choose Run and enter notepad. Or enter notepad in the Search box and select notepad when found. Repeat the same steps, only this time enter Wordpad, to load the Wordpad program.) In the notepad program, insert five lines of text or paste five lines of text into notepad.
 
Position the cursor in the home position of the first line of text. Press the hotkey CTRL+ALT+F and watch the macro copy each line of text in notepad and paste it to Wordpad.