如何在 VBScript 中自动执行右键单击?
我想自动模拟右键单击以打开上下文菜单。菜单打开后,选择可用的所选操作/快捷方式。
我知道如何打开:
WshShell.SendKeys("+{F10}");
或者使用 AutoIt 自动化语言(类似 BASIC):
;--on right click event
MouseClick("right")
$count = 1
Do
Send("{DOWN}")
$count = $count + 1
Until $count > 7
Send("{ENTER}")
;---select shortcut
WinWaitActive("xxxxk")
;----doing execution from the 3rd program
ControlSend("xxxxx", "", "Edit2", "123ABC")
Sleep(500)
ControlSend("xxxxx", "", "Edit3", "123ABC")
Sleep(500)
Send("{ENTER}")
Sleep(500)
WinClose("xxxxx")
WinWaitActive("xxxxx", "Close")
Send("{ENTER}")
我可以吗VBScript 中有类似的东西吗?我觉得太乱了。
I want to automate simulation of a right click to open the context menu. Once the menu is open, select the selected action/shortcut available.
I know how to open:
WshShell.SendKeys("+{F10}");
Or using the AutoIt automation language (BASIC like):
;--on right click event
MouseClick("right")
$count = 1
Do
Send("{DOWN}")
$count = $count + 1
Until $count > 7
Send("{ENTER}")
;---select shortcut
WinWaitActive("xxxxk")
;----doing execution from the 3rd program
ControlSend("xxxxx", "", "Edit2", "123ABC")
Sleep(500)
ControlSend("xxxxx", "", "Edit3", "123ABC")
Sleep(500)
Send("{ENTER}")
Sleep(500)
WinClose("xxxxx")
WinWaitActive("xxxxx", "Close")
Send("{ENTER}")
Can I have something like this in VBScript? Too messy, I think.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
一旦右键单击菜单打开,您的答案就在您的问题中
,发送另一个键“s”(在大多数情况下,“s”用于选择/全选),
您就完成了:)
完整代码
这里是上面代码应该的 在 VBScript 右键单击自动化中工作,
我还想提一下,在标题栏中右键单击相当于 ALT+SPACE,因此,如果您想通过 VBScript 右键单击标题栏,我建议您发送 <代码>ALT+SPACE
来源:http ://msdn.microsoft.com/en-us/library/8c6yea83%28VS.85%29.aspx
your answer is in your question
once the right click menu is open send another key 's' (in most cases 's' is used to select/select all)
and you're done :)
here goes the complete code
the above code should work in VBScript right click automation,
i'd also like to mention that Right-Click in a title bar is equivalent to ALT+SPACE, so if you want to right click on the title bar by vbscript i'll advice you to send
ALT+SPACE
insteadSource: http://msdn.microsoft.com/en-us/library/8c6yea83%28VS.85%29.aspx
右键单击什么?
如果您正在谈论文件/文件夹(在 Windows 资源管理器中),则可以使用 shell 自动化来完成:DoIt 或 调用动词
Right click on what?
If you are talking about files/folders (in Windows Explorer), you can do it with shell automation: DoIt or InvokeVerb