每个半小时运行一次

; File encoding:  UTF-8
/*
AutoHotkey 版本: 1.1.09.01
操作系统:    Windows XP
作者:        sunwind <[email protected]>
博客:        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
  }

你可能感兴趣的:(autohotkey,autohotkey,autohotkey,AHK)