使用内置脚本语言在Windows中检测键组合的最佳方法 [英] Best way to detect key combination in windows using built in scripting languages

查看:98
本文介绍了使用内置脚本语言在Windows中检测键组合的最佳方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我当时正在考虑使用内置脚本语言(例如vb脚本,powershell脚本,批处理脚本等)来检测键组合(最好是窗口键+ a)的方案。有什么办法吗?

I was thinking of a scenario to detect a key combination [preferably window key + a] using the built in scripting languages like vb script, powershell script, batch script etc.. is there any way to do this ?

推荐答案

我个人喜欢 AutoHotKey 您创建了一个脚本,它将检测任何按键组合。它快速且易于使用,而且我每天都会编写和使用许多按键组合。

I personally love AutoHotKey you create a script and it will detect any key combination. It is fast and easy to use and I have dozens of key combinations that I have scripted and use every day.

如果您必须使用内置脚本语言,那么最简单的方法就是以您喜欢的任何语言(例如PowerShell)创建所需的脚本。然后创建一个运行脚本的快捷方式(例如 powershell.exe -file c:\myScript.ps1 之类的东西)。

If you must use a built-in scripting language, then the easiest is to create the desired script in whatever language that you prefer (for ex. PowerShell). Then create a shortcut that will run your script (for ex. something like powershell.exe -file "c:\myScript.ps1").

然后,在测试了快捷方式和脚本之后,转到快捷方式的属性,然后有一个快捷键字段,您可以将组合键绑定到该字段。

Then after testing your shortcut and script, go to the Shortcut's properties, and there is a "Shortcut key" field that you can bind a key combination to.

使用内置语言会比较麻烦,并且每个键组合都必须有单独的脚本和快捷方式。与 AutoHotKey 相比,您可以将所有组合键组合到一个文件中。

Using built in languages is a bit more cumbersome, and you have to have a separate script and shortcut for each key combination. Compared to AutoHotKey which you can combine all your key combinations into one file.

这篇关于使用内置脚本语言在Windows中检测键组合的最佳方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆