如何使用 autohotkey 将密钥发送到 virtualbox

发布于 2024-12-27 05:31:39 字数 219 浏览 1 评论 0原文

我在 Windows 7 中安装了 virtualbox,并安装了 Ubuntu 作为来宾操作系统。

我想按一个键(Alt+F1)来激活Ubuntu并发送继续发送相同的密钥到Ubuntu,然后Ubuntu将激活Ibuntu中的问题。

这意味着我想在Ubuntu中一键激活该程序。 我认为 autohotkey 脚本可以做到这一点。但我不知道怎么办。

I installed virtualbox in my Windows 7 and installed the Ubuntu as guest os.

I want to press a key(Alt+F1) to activate the Ubuntu and send continue send the same key to Ubuntu and then Ubuntu will active the problem inside Ibuntu.

That means I want to press one key to activate the program in Ubuntu.
I think autohotkey script can do it. But I do not know how.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(3

萌︼了一个春 2025-01-03 05:31:39

您可以在 VirtualBox 窗口上尝试 WinActivate,然后使用 SendInput 命令。由于 VirtualBox 使用各种低级挂钩,我不知道它对按键发送的响应如何。

由于它是 Windows 应用程序,因此它有可能接受其他 Windows 消息。 ControlSend 命令可能有用,但我不知道 VBox 是否会将密钥传递给来宾操作系统。

AutoHotkey 很难处理低级应用程序。有些软件,比如游戏,故意阻止人工输入。其他人就自然而然地这样做,例如VirtualBox。

You can try WinActivate on the VirtualBox window, and follow that with SendInput commands. Since VirtualBox uses all sorts of low level hooks, I don't know how well it will respond to key sending.

Since it is a Windows application, there's a chance it will accept other Windows messages. The ControlSend command may be useful, but I don't know if VBox will pass on the keys to the guest OS.

AutoHotkey struggles with low-level applications. Some software, such as games, deliberately prevent artificial input. Others just do it naturally, for example, VirtualBox.

抽个烟儿 2025-01-03 05:31:39

截至撰写本文时,我已更新到版本 6.1.38 r153438 (Qt5.6.2),但我认为这对我来说并不是新的。

根据 1.8.2。捕获和释放键盘和鼠标 在访客窗口的右下角,有一个带有向下箭头的按钮。这表明键盘是否被捕获。如果将光标悬停在其上,工具提示会告诉您含义。切换此功能的键盘快捷键是 Host+k。

默认行为是捕获,为了防止这种情况并从 AHK 脚本发送密钥,右键单击它,选择“键盘设置...”,在对话框中取消选中“自动捕获键盘”复选框。这样做的问题是,每次您想要发送像 Win 这样的密钥时,它都会打开主机菜单而不是客户菜单,因此您每次都需要手动切换以将密钥发送到客户操作系统。

或者,可以允许 Virtaualbox 捕获键盘并使用访客端自动化解决方案。我建议alternativeto.net/software/autohotkey/?platform=linux 这最后一个可能会被您的客户操作系统取代。

As of writing I've updated to Version 6.1.38 r153438 (Qt5.6.2), but I don't think this is new except for me.

As per 1.8.2. Capturing and Releasing Keyboard and Mouse In the lower right corner of the guest window, there is a button with a downward arrow. This indicates if the keyboard is being captured or not. If you hover your cursor over it, a tool tip will tell you the meaning. The keyboard shortcut to toggle this is Host+k.

The default behavior is to capture, to prevent this and send keys from your AHK script, right click it, choose "Keyboard settings...", in the dialogue un-tick "Auto capture keyboard" check box. The problem with this is that every time you want to send keys like Win, it opens the host menu instead of the guest one, so you need to toggle manually every time to send the key to the guest OS.

Alternatively, Virtaualbox may be allowed to capture the keyboard and use a guest side automation solution. I suggest alternativeto.net/software/autohotkey/?platform=linux this last may be replaced by your guest OS.

还给你自由 2025-01-03 05:31:39

由于 Gnome 可以捕获 ctrl+click 和 alt+click,所以我使用:

+RButton::
SendInput {单击,中间}
返回

将中键从触控板发送到 win7 中的 vbox linux。

使用风险自负。

Since Gnome can capture ctrl+click and alt+click, I use:

+RButton::
SendInput {Click, middle}
return

to send middle-click from trackpad to vbox linux in win7.

Use on your own risk.

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