 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Pallie
Joined: 05 Jul 2004 Posts: 57 Location: London
|
Posted: Mon Aug 09, 2004 11:23 pm Post subject: Record and playback keystrokes |
|
|
Hi
I wanted a script that would allow me to record a series of keystrokes, and then play them back. I tried the following and it works to a degree, but it will not record special keys such as {F4} or {DOWN}. I'm sure there are other programs that would do this (I would be interested to know if anyone knows of a good one) but if I can get it working I want to expand it for a particular use.
| Code: | ; Record keystrokes
#r::
input, keystrokes, V C , {esc}
Return
; Playback Keystrokes
#p::
send, %keystrokes%
return
; Save Keystrokes
#s::
FileSelectFile, SelectedFile, 18, , Save, Text Documents (*.txt)
if SelectedFile =
MsgBox, The user didn't select anything.
else
{
FileDelete, %SelectedFile%
FileAppend, %keystrokes%, %SelectedFile%
}
Return
; Open Keystrokes File
#o::
FileSelectFile, SelectedFile, 3, , Open a file, Text Documents (*.txt)
Loop, Read, %SelectedFile%
{
keystrokes = %keystrokes%%A_LoopReadLine%
}
Return
; Display Keystrokes
#d:: msgbox, %keystrokes% |
I think I am trying to use input for a use it was not designed for. I thought about having a hotkey for every key on the keyboard but I was hoping there would be an easier solution.
Thanks for any pointers
Mike |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Tue Aug 10, 2004 1:08 am Post subject: |
|
|
Consider using Larry's AutoScriptWriter (for which a shortcut is included in the Start Menu). You could probably set it up so that it is launched and starts recording at the press of a hotkey. You could probably do it in the background by launching it minimized and then using ControlSend/ControlClick/ControlGetText on it.
Another idea is to define all desired non-character keys as end-keys and then put the Input command in a loop (checking the value of ErrorLevel after each cycle to determine which EndKey was pressed).
Finally, there is an item on the to-do list to enhance the Input command to optionally record non-character keys such as {F4} and {Down}. |
|
| Back to top |
|
 |
Pallie
Joined: 05 Jul 2004 Posts: 57 Location: London
|
Posted: Tue Aug 10, 2004 11:49 pm Post subject: |
|
|
Thanks for your reply Chris
I looked at AutoScriptWriter but I wanted to be in more control of the recording process, and I've never managed to grasp controls, so I adopted your second suggestion which works a treat.
Thanks again |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|