When sending keystrokes to other applications remember that Macro Scheduler works much faster than a human being can type. Many applications do form field verification or background processing on the fly as the text is received. And most applications were designed on the assumption that a human being would be operating them. It may not have occurred to the developers that a robot might try to send a stream of text to the UI at the rate of 5000 characters a second!
With some applications if you try to send too many characters at once you may find that some of those characters fail to show up, or the string is truncated.
The solution should be obvious by now. That is to slow down the key send rate. You can do this easily by setting the SK_DELAY parameter which introduces a specified millisecond delay between each character.
Of course you could break the long string down into smaller chunks and insert a delay between them:
Send>part_1 Wait>0.3 Send>part_2 Wait>0.2 Send>part_3
But SK_DELAY is simpler and easier if you can’t control the length of the data easily.
A related issue I see every now and then is when “tabbing” from one field to another on a form. Pressing the tab key moves the focus to the next field, so we use this while sending data into a form. Sometimes we’ll encounter an application which needs a bit of time after a field has been focused before it can accept data, or the other way around. So sending Tab immediately after/before sending the data with no delay fails to work. Adding in a small delay between sending the data and the Tab solves it:
Send>field_data Wait>0.3 Press Tab Wait>0.3 Send>next_field Wait>0.3 Press Tab etc
Similarly when we need to tab through lots of fields at once without sending data we may try to save ourselves coding time by writing:
Press Tab * 10
But if the app needs time to react between each tab we may have to split that out into separate tabs with delays between them or replace with a repeat/until loop:
Let>tabs=0 Repeat>tabs Press Tab Wait>0.2 Let>tabs=tabs+1 Until>tabs=10
As I’ve said many times before the most common causes of things not working as expected are either timing or focus. Macros run way faster than a human can type which is often beneficial but if things aren’t quite right start off by slowing the macro down a bit. You can always speed it up later!