![autohotkey](https://i-blog.csdnimg.cn/blog_migrate/a3922675cc92ffe3b5f4b0641adf44b7.png)
autohotkey
![AHK post AHK post](https://i-blog.csdnimg.cn/blog_migrate/5321e84b5869a008faff7a017ce935c5.png)
AutoHotkey scripts are a great way to customize your computer, but may seem daunting at first. Don’t worry – getting started is much easier than it looks! Read on to see.
AutoHotkey脚本是自定义计算机的好方法,但乍一看似乎令人生畏。 不用担心-入门比看起来容易得多! 继续阅读。
[Image: mlinksva]
[图片: mlinksva ]
获取自动热键 (Getting AutoHotkey)
The first thing you want to do is download and install AutoHotkey. Go to the AutoHotkey download page. You will be presented with a number of download links:
您要做的第一件事是下载并安装AutoHotkey。 转到AutoHotkey下载页面。 您将获得许多下载链接:
![image image](https://i-blog.csdnimg.cn/blog_migrate/87ad9024bcadd4c88d68eb71956666c0.png)
Click the first one, the installer for AutoHotkey_L. Save it to your hard drive – that’s what we’re going to use.
单击第一个,即AutoHotkey_L的安装程序。 将其保存到硬盘上-这就是我们要使用的。
历史的一点:为什么会有两个版本? (A Bit of History: Why Are There Two Versions?)
You may be wondering why the download page offers both AutoHotkey_L and AutoHotkey Basic. What happened is that AutoHotkey’s original developer decided to stop working on the project; but AutoHotkey wouldn’t die so fast. Since the project is open-source and has an vibrant developer community, a number of efforts to continue development were started. Out of these, AutoHotkey_L was chosen as “AutoHotkey’s future”, and is now offered on the official download page.
您可能想知道为什么下载页面同时提供AutoHotkey_L和AutoHotkey Basic。 发生的事情是AutoHotkey的原始开发人员决定停止从事该项目。 但是AutoHotkey不会死得那么快。 由于该项目是开源的,并且拥有一个活跃的开发人员社区,因此开始了许多继续开发的工作。 其中,AutoHotkey_L被选为“ AutoHotkey的未来”,现已在官方下载页面上提供。
安装自动热键 (Installing AutoHotkey)
Okay, now that you’ve downloaded the executable, it’s time to set it up. The installer is fairly straightforward except for this next step which offers multiple choices:
好的,既然您已经下载了可执行文件,就该进行设置了。 安装程序非常简单,但下一步提供了多种选择:
![image image](https://i-blog.csdnimg.cn/blog_migrate/55a29d741baf5ab1f734e8e66b65cf03.png)
We recommend to keep this at the default, Unicode 32-bit. If you’re running a 64-bit version of Windows you could opt for the 64-bit Unicode version, but it doesn’t offer significant performance gains for most scripts. Regarding ANSI, you should only choose this option if there’s a specific script you’d like to run which you know for sure doesn’t play well with Unicode. This very rarely happens. Bottom line: unless you have a good reason, stick to the default and click Next.
我们建议将其保留为默认的Unicode 32位。 如果您正在运行Windows的64位版本,则可以选择64位Unicode版本,但是对于大多数脚本而言,它并不能显着提高性能。 关于ANSI,仅当您要运行的特定脚本确实可以与Unicode配合使用时,才应选择此选项。 这种情况很少发生。 底线:除非有充分的理由,否则请遵循默认值,然后单击“下一步”。
获取脚本:保存代码段 (Getting The Script: Saving a Snippet)
Now that you’ve got AutoHotkey set up, it’s time to get your first script. Some AutoHotkey scripts are so short, they’re posted online as short snippets of text. You can see one such script in our recent post about How to Fake Back and Forward Buttons With a Three-button Mouse. Select the script text and copy it:
现在您已经设置了AutoHotkey,是时候获取第一个脚本了。 一些AutoHotkey脚本非常简短,它们以简短的文本片段形式在线发布。 您可以在我们最近的帖子中看到一个这样的脚本,该脚本有关如何使用三键鼠标伪造前进和后退按钮。 选择脚本文本并复制它:
![image image](https://i-blog.csdnimg.cn/blog_migrate/9b53a1bf50848f62a989184bfa8c8f7b.png)
Now run Notepad and paste the script in. Make sure you got the whole thing, from the very beginning to the end.
现在运行记事本并将脚本粘贴到其中。确保从头到尾都完整掌握了所有内容。
![image image](https://i-blog.csdnimg.cn/blog_migrate/73209ad1acfb74df5855882582b0e218.png)
Next, save the file somewhere on your computer. The filename doesn’t matter, but the extension must be AHK. If you installed the Unicode version of AutoHotkey_L, it would be a good idea to save the script with Unicode encoding. Most scripts would probably work if you save them using the default encoding (ANSI), but Unicode is a safe option.
接下来,将文件保存在计算机上的某个位置。 文件名无关紧要,但是扩展名必须是AHK。 如果您安装了Unicode版本的AutoHotkey_L,则最好使用Unicode编码保存脚本。 如果使用默认编码(ANSI)保存脚本,大多数脚本可能会起作用,但是Unicode是安全的选择。
![image image](https://i-blog.csdnimg.cn/blog_migrate/8b1af6bfc56cd2c25d43609fbfc33f80.png)
Pro Tip: Understanding Character Encodings
专家提示:了解字符编码
If you find all this talk about Unicode and ANSI a bit confusing, you might want to take a quick look at our recent post explaining What Are Character Encodings and How They Differ.
如果您对Unicode和ANSI的所有讨论都感到有些困惑,则不妨快速浏览一下我们最近的文章,其中解释了什么是字符编码及其区别。
获取脚本:保存文件 (Getting The Script: Saving a File)
Some scripts go on for more than just a few lines; these are often offered as files rather than pasted in-page. We recently posted one of these larger scripts under How to Get Spelling Autocorrect Across All Applications on Your System, so that’s what we’ll use for the example. Right-click the link to the AHK file and select to save it locally:
有些脚本不止几行。 这些通常以文件形式提供,而不是粘贴在页面中。 我们最近在“如何在系统上的所有应用程序中进行拼写自动更正”下发布了这些较大的脚本之一,因此我们将在此示例中使用它。 右键单击指向AHK文件的链接,然后选择将其保存在本地:
![image image](https://i-blog.csdnimg.cn/blog_migrate/9214a11574578ab1cf3e6f874a9be115.png)
Again, make sure you save it as an AHK file.
同样,请确保将其另存为AHK文件。
运行脚本 (Running The Script)
You should now have an AHK file somewhere on your system, and AutoHotkey all set up. Simply double-click the AHK file to run it.
您现在应该在系统上的某个位置有一个AHK文件,并且AutoHotkey都已设置。 只需双击AHK文件即可运行它。
![image image](https://i-blog.csdnimg.cn/blog_migrate/010a86be72d019b7bf6e981a870bd850.png)
When the script is running, you should see a small icon in your system tray. Hovering over this icon with your mouse will pop up a tooltip showing the name of the script. AutoHotkey and AutoHotkey_L use slightly different icons.
当脚本运行时,您应该在系统托盘中看到一个小图标。 将鼠标悬停在此图标上将弹出一个工具提示,显示脚本名称。 AutoHotkey和AutoHotkey_L使用略有不同的图标。
![image image](https://i-blog.csdnimg.cn/blog_migrate/f41c5f84ad979d9983561363199ddd8d.png)
如果您的脚本不起作用 (If Your Script Doesn’t Work)
Most scripts work right off the bat. However, if your script won’t run and pops up an error message, go back to the AutoHotkey download page and get “AutoHotkey Basic” (the second option). Uninstall AutoHotkey_L, Install AutoHotkey Basic and try running the script again.
大多数脚本立即可用。 但是,如果您的脚本无法运行并弹出错误消息,请返回到AutoHotkey下载页面并获取“ AutoHotkey Basic”(第二个选项)。 卸载AutoHotkey_L,安装AutoHotkey Basic,然后尝试再次运行脚本。
You can also go back to “Saving a Snippet” and try saving the script with a different character encoding.
您也可以返回“保存代码段”,然后尝试使用其他字符编码保存脚本。
退出脚本 (Exiting the Script)
When you’re done working with a script, right-click its system tray icon and select Exit.
使用完脚本后,右键单击其系统任务栏图标,然后选择“退出”。
![image image](https://i-blog.csdnimg.cn/blog_migrate/3ff1c7ac9afb2adaec0e16c7a093105c.png)
翻译自: https://www.howtogeek.com/56481/the-beginners-guide-to-using-an-autohotkey-script/
autohotkey