Have a Question?
Print

How do I switch between applications for repetitive tasks such as copy and paste?

How do I switch between applications for repetitive tasks such as copy and paste?

This example will show how to copy text from one application and paste it into another. You might be tempted to try and 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.

Let’s run through an example. Create a new Hot Key by clicking on HotKeys | Add HotKey. Press CTRL+ALT+F to select this hotkey and click on the “Enter Keystrokes” button. This will take us to the HotKey Editor window. Type “Copy and Paste” into the nickname field, to help us remember later what this macro does.

Double click on the Activate/Launch command located in the list of commands. From the Activate/Launch Program window that appears, select the “Activate Program Only” option. We now need to specify which program we will be activating. For the “Window Title”, let’s enter “notepad” (without the quotes). Now click on the “OK” button. This first step tells us to bring notepad to the front and it is ready to receive keystrokes.

To make sure that the macro doesn’t start processing the next command before notepad
has focus, double click on the Wait command. Make sure the Wait for Window Title to Appear option is selected. Enter notepad as the Window Title and click OK. This will instruct the macro to wait until notepad has focus and is ready to accept keystrokes.

We now want to enter our commands to be processed in notepad. Let’s assume we want to repetitively copy one line at a time over to Wordpad. Our next command would be to highlight one line of text. This can be done by using Shift+End. In the yellow area of the HotKey Editor, click on “Shift” and then click on “End”. Or you may manually type .

The next step is to copy the highlighted text to the clipboard. We can do this by using CTRL+C or using “EDIT | COPY” from the menu of notepad. For our example, we will use CTRL+C. So you would click on “CTRL” or manually type . Next enter the letter “c” (no quotes and lowercase).

Now that the line has been copied to the clipboard, we are ready to go paste it into
Wordpad. But first, lets have the macro move the cursor to the next line in notepad,so that we will be ready to copy the next line. Click on Home and Arrow Down from the yellow area of the HotKey Editor. Or manually type into the Enter Keystrokes edit field.

Now to activate Wordpad, we follow the same process as before by double clicking on the Activate/Launch command. Select “Activate Program Only” and enter “wordpad” (without the quotes) as the “Window Title” and click the OK button. This will activate Wordpad and send the mouse 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 will instruct the macro to wait until Wordpad has focus and is ready to accept keystrokes.

Next we would want to issue the paste command. We can do this by either accessing the menu or by simply using a CTRL+V. Click on Ctrl from the list of keys available and then type in the letter v into the Enter Keystrokes edit field.

Now let’s place an <ENTER> into the macro which will move the cursor to a new line in Word. To do so, just click on Enter from the list of keys. We are almost done now. But, 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.

Let’s set the macro up so that it copies the first 5 lines of text in notepad over to Wordpad. To do so, place the cursor to the beginning of our macro 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 Repeat Count 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 in the loop 5 times.

The resulting macro should appear as follows:

<REPEAT:0005><ACTIVATE:notepad><WAITWIN2:0:0:notepad><SHIFT><END><CTRL>c<HOME><DOWN ARROW><ACTIVATE:wordpad><WAITWIN2:0:0:wordpad><CTRL>v<ENTER><ENDREP>

Click on File | Save HotKey to save the macro. Then click on the HotKey Explorer icon to return to the Keyboard Express – Explorer. You macro should be displayed in the list of macros.

Testing the Macro
First minimize Keyboard Express. Then run notepad and Wordpad. (To run notepad, click on Start | Run from the bottom left of the computer screen, enter notepad and click the OK button. Repeat the same steps, only this time enter Wordpad, to load the Wordpad program.) In the notepad program, write five lines of text or copy 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 your text in notepad and paste it to Wordpad.