How to record and play keystrokes, example based on copying file names from Windows Explorer to Excel
Problem
Some times it is needed to repeat the same key sequence many times. An example: to copy file names from Windows Explorer to another application. Windows standard copy/paste function doesn't allow this. Watch a video tutorial and read details below:
Solution
Hot Keyboard allows you to record a sequence of keystrokes and repeat them a number of times at desired speed. We will record sequence to copy file name once and repeat them for all files in the folder.
Requirements
Step-by-step
- First of all we need to create a sequence to put in a loop. Hot Keyboard can record mouse clicks also, but we will focus on keyboard shortcuts, and some you will find it helpful in the future.
- Remember this key sequence: F2, Ctrl+C, Alt+Tab, Ctrl+V, Down, Alt+Tab, Down
- Open Excel sheet and click with left mouse button to the first cell.
- Open Explorer, go to a folder with files, and click on the first file with you mouse left button.
- Double click on Hot Keyboard icon in the toolbar and click "New macro" button, then select "Record/play keystrokes" macro
- In a macro properties uncheck "Record and play mouse events" as we don't need mouse to be recorded
- Click Record keystores and mouse actions button (two alerts may popup, read them and close)
- When record begins repeat key sequence F2, Ctrl+C, Alt+Tab, Ctrl+V, Down, Alt+Tab, Down in a given order once, and then press Ctrl+Break to stop macro recording
- Hot Keyboard window opens back.
- Set playback speed to "4x" and repeat count to a number of files minus one (you already copied the first file),
- Set a hot key to start this macro, for example Ctrl+Alt+Shift+M
- Close Hot Keyboard
- Click on Explorer's title to activate the window
- Press Ctrl+Alt+Shift+M
- If something went wrong, press Ctrl+Break to stop macro execution and verify steps above
- Relax and drink coffee
Tips
- Ctrl+Break stops both record and playback, alternatively you can double-click Hot Keyboard icon in the toolbar
- You can adjust playback speed to execute macro several times faster. Use with care, if you PC is not very fast, Hot Keyboard may play keys faster than Windows can accept. We recommend x4 value for this macro.
- You may wish to assign a hot key to execute the macro any time. But remember to close all windows and set initial position. Hot Keyboard simply repeats keystrokes. Explorer should be active window before you start macro
- There is a global hot key you can set to start macro record, set it to create record/play macros quickly