简体   繁体   中英

Sleeping in SendKeys.Send method

I want to know if there's something similar to SendKeys.Send("test text {sleep 250} another test text"); in C#.

I know I can use Thread.Sleep but I get the string from the user input, and I won't be able to know how many times I have to sleep.

I don't believe there is a way to have SendKeys.Send() pause mid string.

If your reading the string to send from user input, you'd be better off parsing this string into a list of partial strings to send and pause between.

ie using your example, you'd have a list of strings: "text text " , " another test test"
and a list of sleep intervals: 250

The list of sleep intervals would naturally always be 1 item shorter than the list of string to send.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM