How to repeat a sequence of roughly 40 keyboard clicks in windows 2000 professional to stop insanity
June 16, 2009 9:57 AM   Subscribe

I'm using Windows 2000 professional. I'm copying data from excel to the forms on separate pages of a website, and have to repeat a string of keyboard controls several times. Is there an application I can download to do this automatically? Does the computer come with a tool that allows you you type a series of keys into the computer, then just "repeat" 83 times?

Here's what I'm typing (although I'll have to use different ones some time in the future):

control C (copy)
alt tab (change to firefox app.)
tab tab tab (to get to the right part of the form)
control V (paste)
tab (next part of the form)
alt tab (change back to excel app.)
right arrow
control C
alt tab
control V
tab tab
660 (typing in this value)
450 (again, typing in this value)
tab tab
control w (close window in firefox)
alt tab
left arrow
down arrow

This is the complete string of keys I'm hitting. My computer isn't the fastest of computers... if I run a macro (is that what it's called?), will it be able to keep up? I have to do this stuff 83 times (and I'll have to do three different but similar steps 83 times once this step is finished). Help for a novice? Thanks!

I feel I should mention, I can't write javascript, I have no money to pay anyone (I'm interning, thus the sucky job), and I have to wear wrist braces because of carpal tunnel syndrome)
posted by omnigut to Computers & Internet (9 answers total) 3 users marked this as a favorite
Autoit will allow you do do this and is fairly straightforward to "learn". Here is kind of an example going off your first few lines.
send("^c") ; uses the ^ for control
send("!{tab}") ; uses ! for alt and most function keys are {name}
send("{tab 3}") ; putting a number inside a {} key will repeat it
send("^v") ; an example of sending a control+v

Plus you can throw in sleep(200) (200 is ms, 1000 would be 1 second) to wait for applications to "catch up" or use commands like "Winwaitactive("Microsoft Excel")" which would wait for that window to gain focus before proceeding.

I am not a programmer or generally good at these types of things but autoit is excellent for this type of thing, especially in cases that don't require input, just emulating keystrokes.
posted by syntheticfaith at 10:03 AM on June 16, 2009 [1 favorite]

We use something called MacroMania at the office; it can definitely do such a thing. It's not entirely automated, but assigns a bunch of separate keystroke actions to a single key on the keyboard (usually an F-key). Its internal programming language looks a lot like syntheticfake's Autoit script.
posted by AzraelBrown at 10:18 AM on June 16, 2009

Cool, syntheticfaith, I'll try that out. If I can't get it to work (although I think I should be okay, considering your help) I'll paste the commands I've asked Autoit to run here. I love mefi!

Now if only I could get Autoit to write that novel I've always meant to finish...
posted by omnigut at 10:19 AM on June 16, 2009

send("love") Thanks AzraelBrown, looks good. If I can't get Autoit to work, I'll consider send("$$") for MacroMania
posted by omnigut at 10:21 AM on June 16, 2009

While we have the paid version of MacroMania, if you don't register it the software is just naggy about it -- if you only need it for this one task, don't pay for it, just use the trial version.
posted by AzraelBrown at 10:26 AM on June 16, 2009

Last thing before I run into a meeting, once you get it all written out you can assign a hotkey to it with something like

HotKeySet("1","Keystrokes") ; sets 1 as the hotkey

while 1
sleep(200) ; this is just a loop that waits for your key press

Func Keystrokes() ;name of the function, you can see it's name above with hotkeyset
;here is where the key sequences go
posted by syntheticfaith at 10:27 AM on June 16, 2009

In case anyone else is interested, I just found this, which explains how to make autoit run keys
posted by omnigut at 10:29 AM on June 16, 2009

TypeitIn is another utility that does this.
posted by soelo at 10:32 AM on June 16, 2009

Not sure if it is any better than those mentioned above, but you can do this natively in Windows using its scripting, see this for example:

Automate tasks with Windows Script Host's SendKeys method

I'm not sure if it (or indeed any of the other options) can use Alt-Tab to activate other windows, but it is probably better anyway to use AppActivate as mentioned in the article, as you can specify the window to activate by name.
posted by Boobus Tuber at 1:35 PM on June 16, 2009

« Older Should I lawyer up for an unenforcable Non-compete...   |   How does adding links/menu items work in Drupal? Newer »
This thread is closed to new comments.