SendKeys Ctrl-A 不起作用
我正在尝试发送 CTRL A (在本例中选择全部到应用程序,但尝试可能不起作用)我已经尝试了很多组合但都无济于事,有什么想法吗?
IntPtr appHandle = FindWindow(null, "Document1 - Microsoft Word");
if (appHandle == IntPtr.Zero)
{
MessageBox.Show("Specified app is not running.");
return;
}
SetForegroundWindow(appHandle);
System.Threading.Thread.Sleep(500);
//SendKeys.SendWait("111");
SendKeys.SendWait("^A");
//SendKeys.SendWait("^(A)"); //ctrl a
//SendKeys.SendWait("(^A)");
I'm trying to send CTRL A (select all to an app in this case word but try as I might it doesn't work) I've tried quite a few combinations but all to no avail, any ideas?
IntPtr appHandle = FindWindow(null, "Document1 - Microsoft Word");
if (appHandle == IntPtr.Zero)
{
MessageBox.Show("Specified app is not running.");
return;
}
SetForegroundWindow(appHandle);
System.Threading.Thread.Sleep(500);
//SendKeys.SendWait("111");
SendKeys.SendWait("^A");
//SendKeys.SendWait("^(A)"); //ctrl a
//SendKeys.SendWait("(^A)");
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
要指定在按下其他几个键时应按住 SHIFT、CTRL 和 ALT 的任意组合,请附上这些键的代码括号内。例如,要指定在按下 E 和 C 时按住 SHIFT,请使用
+(EC)
。要指定在按下 E 时按住 SHIFT,然后按下 C,而不按下 SHIFT,请使用+欧共体
。答案是:
To specify that any combination of SHIFT, CTRL, and ALT should be held down while several other keys are pressed, enclose the code for those keys in parentheses. For example, to specify to hold down SHIFT while E and C are pressed, use
+(EC)
. To specify to hold down SHIFT while E is pressed, followed by C without SHIFT, use+EC
.Answer is:
我遇到了同样的问题
我想要选择文本,输入文本控件
SendKeys.SendWait("^A") 不起作用,Sendkeys.SendWait "^A" 不起作用
Sendkeys.SendWait("^a") 工作正常
以获取更多信息:
http://www.autoitscript.com/autoit3/docs/functions/Send。 htm
hth
I got same problem
I want select text an input text control
SendKeys.SendWait("^A") doesn't works nor Sendkeys.SendWait "^A" doessn't works
Sendkeys.SendWait("^a") works ok
for more info:
http://www.autoitscript.com/autoit3/docs/functions/Send.htm
hth
SendKeys 区分大小写。试试这个:
我不确定,但它似乎
意味着 Ctrl+Shift+A。至少在某些应用中确实是这样工作的。
SendKeys is case-sensitive. Try this:
I'm not sure, but it seems like
means Ctrl+Shift+A. At least it does work this way in some applications.
你尝试过吗
Did you try
经历过这个。
唯一可行的解决方案:
找到要输入文本的元素
been through this.
The only working solution:
Find your element where you want to enter text