When automating form submissions with WinAutomation, it is usually needed to send the same keystroke multiple times. A typical example is the {Tab} keystroke which is used to change the input field that we are currently editing. For example, in the form that is shown below:

you will have to send 11 Tab keystrokes in order to modify the "Distance from ground".
Even though you can do this by copying and pasting {Tab} in the "Text to Send" input field of the "Send Keys" action, it is not the recommended solution for 2 main reasons:
1) If you have a rather large job, with many "Send Keys" actions, it becomes very hard to keep track of what the job is doing when you see a lot of {Tab} or {Enter} next to each other.
2) In some other cases you may need to send 200 {Down} keystrokes. Would you have the patience to copy and paste it 200 times?
Now, that I think about it, there is another reason: there is a better way to do it!
WinAutomation allows you to send multiple repetitive keystrokes by using the notation {X:n}, where X is the name of the keystroke and n is the number or repetitions. For example, if you want to send 40 {Tab} keystrokes, you can just write: {Tab:40}, or if you want to send 450 down arrow keys, you can use the notation: {Down:450}!
Are you sure that you have the latest release of WinAutomation installed in your machine? This is a feature that has been added in WinAutomation v3.0.1, so please make sure that you have the latest release installed (v3.0.3)
Hello Thomas,
Thank you for this interesting post. It is very helpful to send multiple repetitive keystrokes with send keys.
On the other hand, I have try with {Tab:3}for exemple, in a active window. But the result has been to write {Tab:3} into the active form instead the effect to jump 3 times.
So I have used the "move mouse" option, but it only works sometimes.
Please, how can I change from one to other form to fill?
Best regards,
Jorge
Post new comment