博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
如何使计算机每隔X秒按一次键
阅读量:2507 次
发布时间:2019-05-11

本文共 2185 字,大约阅读时间需要 7 分钟。

image

Have you ever needed to press a key every couple of seconds, or every few minutes? Perhaps you’re playing a video game and you’re waiting for an item, or you’ve got some other reason. Either way, here’s how to make your PC do it automatically.

您是否需要每隔几秒钟或每隔几分钟按一次键? 也许您在玩电子游戏并且正在等待商品,或者还有其他原因。 无论哪种方式,这都是使您的PC自动执行操作的方法。

You’ll need to start by downloading and installing , which is a simple scripting language that allows you to create easy scripts. Once you do that, right-click anywhere and choose New –> AutoHotkey Script.

您需要首先下载并安装 ,这是一种简单的脚本语言,可让您创建简单的脚本。 完成后,右键单击任意位置,然后选择“新建”->“自动热键脚本”。

Once you’ve done that, paste the following into the script:

完成此操作后,将以下内容粘贴到脚本中:

#Persistent SetTimer, PressTheKey, 1800000 Return

#Persistent SetTimer,PressTheKey,1800000返回

PressTheKey: Send, {Space} Return

PressTheKey:发送,{空格}返回

This simple script will wait every 30 minutes and press the Spacebar. You can adjust the 1800000 number above to the amount of milliseconds required. So, for example, if you wanted it to run every 2 minutes, you’d use 60 seconds * 2 minutes * 1000 milliseconds = 120000 total milliseconds.

这个简单的脚本将每30分钟等待一次,然后按空格键。 您可以将上面的1800000数字调整为所需的毫秒数。 因此,例如,如果您希望它每2分钟运行一次,那么您将使用60秒* 2分钟* 1000毫秒= 120000总毫秒。

(Warning: Don’t set a very low number of milliseconds. For example, if you set the time to 10 milliseconds, the script will press the Spacebar one hundred times per second, which could cause obvious problems.)

(警告:不要将毫秒数设置得太低。例如,如果将时间设置为10毫秒,脚本将每秒按空格键一百次,这可能会引起明显的问题。)

image

Save the file name as whatever you’d like, and then double-click on it to run it.

将文件名保存为所需的名称,然后双击运行它。

You can also send another hotkey or any number of characters just by changing the Send, {Space} line to something else—you can literally type out some letters you want to send, or you can use some of the special keys on the . For example, to make it send the word “lazy” and then press the Space bar, you could use:

您还可以通过将Send {Space}行更改为其他内容来发送另一个热键或任意数量的字符-您可以逐字键入要发送的一些字母,也可以使用某些特殊键 。 例如,要使其发送“ lazy”一词,然后按空格键,可以使用:

Send,lazy{Space}

发送,懒惰{Space}

I’m not entirely certain what you’ll want to use this for, but that’s what makes scripting so much fun.

我不确定您将要使用它什么,但这就是使脚本编写如此有趣的原因。

翻译自:

转载地址:http://uizwd.baihongyu.com/

你可能感兴趣的文章
注册用户
查看>>
TZC Intercommunication System
查看>>
HDU 4571 SPFA+DP
查看>>
centos 创建以日期为名的文件夹
查看>>
Java Timer触发定时器
查看>>
Page Object设计模式
查看>>
程序的基础知识
查看>>
在VIM中使用GDB调试 – 使用vimgdb
查看>>
python爬虫---从零开始(五)pyQuery库
查看>>
POJ2236(KB5-A)
查看>>
Centos MySQL数据库迁移详细步骤
查看>>
2初出茅庐--初级篇2.1
查看>>
新建 WinCE7.0 下的 Silverlight 工程
查看>>
腾讯的张小龙是一个怎样的人?
查看>>
jxl写入excel实现数据导出功能
查看>>
linux文件目录类命令|--cp指令
查看>>
.net MVC 404错误解决方法
查看>>
linux系统目录结构
查看>>
git
查看>>
btn按钮之间事件相互调用
查看>>