We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(5)
您在 Windows 上尝试过任务计划程序吗? (大多数 Windows 版本都内置了)
这取决于您的Windows版本,但是如果您设置了高级任务,您可以让它每x分钟运行一次
Have you tried Task Scheduler on windows? (it's built-in most of windows versions)
It depends on your windows version, but if you set up an advanced task, you can make it run every x minutes
看
autoit 帮助中的 AdlibRegister 函数
see
AdlibRegister function in autoit help
好吧,实际上你也可以使用 autoit 以多种方式做到这一点......
我不知道“不睡觉”是否意味着您不想让程序保持打开状态。如果是这样,您可以编写自己的 autoit 程序,每 20 分钟运行一次 .exe autoit 脚本。
或者您可以通过检查系统时钟在自己的脚本中完成此操作。
Well actually you can do this in various ways with autoit too...
I don't know if with "no sleep" you mean you don't want to keep the program open. If so, you can write your own autoit program to run your .exe autoit script every 20 mins.
Or you can do it in your own script by checking the system clock.
使用
_Timer_SetTimer()
设置您想要的计时器,无需Sleep()
。Use
_Timer_SetTimer()
to set a timer you want withoutSleep()
.如果您希望脚本持续运行,
Sleep()
非常重要。您可以执行以下操作来获得 20 分钟的等待时间:如果根本不使用
Sleep()
,它将消耗大量 CPU,因为它会尽可能快地检查计时器。另外,当第一个IF
检查时,您有很小的机会处于 1199999 毫秒,而当它评估Until
时,您很有可能处于 1200001 毫秒,并且它会跳过该消息。最好的办法是让脚本执行任何操作,然后使用 Windows 任务计划程序每 20 分钟运行一次。虽然我查了一下,每20分钟没有一个选项。
Sleep()
is important if you want the script to be running constantly. You can do something like this to get a 20 minute wait:Without
Sleep()
at all, it's going to be eating up a good amount of CPU since it's checking the timer as fast as it possibly can. Plus, you run a very small chance being at 1199999 ms when the firstIF
checks, and being at 1200001 when it evaluates theUntil
and it would skip the message.Your best bet is to just make your script do whatever, then use Windows Task Scheduler to run every 20 minutes. Though when I checked, there's no option for every 20 minutes.