您的位置:首页 > 其它

[AHK]每个半小时运行一次

2012-12-20 11:37 573 查看
; File encoding:  UTF-8

/*

AutoHotkey 版本: 1.1.09.01

操作系统:    Windows XP

作者:        sunwind <1576157@qq.com>

博客:        http://blog.csdn.net/liuyukuan

脚本说明:此为脚本每隔半小时运行一次某动作。

脚本版本:   v1.0

Timestamp:2012-12-20 11:40

*/

#Persistent

#SingleInstance,force

start:

  TargetTime:= addMinutes(%now%,30)

  SplashTextOn,300,, 执行下一次动作时间是:%TargetTime%

  Sleep, 3000

  SplashTextOff

  TimeUntilTarget:=TargetTime

  TimeUntilTarget -= %A_Now%, Seconds

  If TimeUntilTarget <=0

    {

      MsgBox The target time is alReady past!

      ExitApp

    }

  TimeUntilTarget *= 1000 ; Convert to milliSeconds.

  SetTimer, Timer1, %TimeUntilTarget%

Return

Timer1:

  SetTimer, Timer1, off  ; i.e. perform this subroutine only once.

  ; In case you want to be warned before it happens, in case it changes the

  ; active window or otherwise disrupts what the user is working on:

  SplashTextOn,,, %TargetTime%到了,It's about to happen.

  Sleep, 3000

  SplashTextOff

  ; And here perform whatever action you wanted scheduled:

  ; ...

  Gosub start

Return

addMinutes(strTime,_minutes=0)

  {

    strTime+=_Minutes,Minutes

    Return strTime

  }
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  ahk AutoHotKey 定时
相关文章推荐