如何在 VBScript 中自动执行右键单击?

发布于 2024-08-06 04:34:40 字数 806 浏览 8 评论 0原文

我想自动模拟右键单击以打开上下文菜单。菜单打开后,选择可用的所选操作/快捷方式。

我知道如何打开:

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

装纯掩盖桑 2024-08-13 04:34:40

一旦右键单击菜单打开,您的答案就在您的问题中

WshShell.SendKeys("+{F10}");

,发送另一个键“s”(在大多数情况下,“s”用于选择/全选),

shell.Sendkeys  "s"

您就完成了:)

完整代码

shell.Sendkeys  ("+{F10}")
shell.Sendkeys  "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

WshShell.SendKeys("+{F10}");

once the right click menu is open send another key 's' (in most cases 's' is used to select/select all)

shell.Sendkeys  "s"

and you're done :)

here goes the complete code

shell.Sendkeys  ("+{F10}")
shell.Sendkeys  "s"

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 instead

Source: http://msdn.microsoft.com/en-us/library/8c6yea83%28VS.85%29.aspx

回首观望 2024-08-13 04:34:40

右键单击什么?

如果您正在谈论文件/文件夹(在 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文