Reputation: 291
i have been using SendKeys.SendWait("insert letter here"); to send a letter to an all ready focused application. This works fine. I have aldo been using it like SendKeys.SendWait(letterstosend); to send a string with only letters in. I notice however it wont send a tring that has both letters and numbers in. It focuses the application but sends nothing.
Can anyone advise on how to write a loop to read the first letter in a string and then send it with the SendKeys.SendWait command and then read the second letter and send that etc for thw whole string?
Thanks
Upvotes: 2
Views: 8713
Reputation: 2441
SendKeys should definitely handle multiple letters well, however, if you want to send each character you can solve it like this:
string text = "abc123";
foreach(char c in text)
SendKeys.SendWait(c.ToString());
Note that there are several special characters in SendKeys that you might have to escape for this to work properly. More info on MSDN.
This might also have been the problem why your original approach failed.
Upvotes: 4