Aug 24, 2008

autohotkey快捷键与暂停

#MaxThreadsPerHotkey 3 ;不知道什么作用,不过有用
#z:: ; Win+Z hotkey (可以改成自己喜欢的 ^!p ctrl+alt+p).
#MaxThreadsPerHotkey 1 ;同样有用
if KeepWinZRunning ; This means an underlying thread is already running the loop below.
{
  KeepWinZRunning := false ; 如果想执行完循环的内容 Signal that thread's loop to stop.
  return ; End this thread so that the one underneath will resume and see the change made by the line above.
}
; Otherwise:
KeepWinZRunning := true
Loop 1
{
  ; The next two lines are the action you want to repeat (update them to suit your preferences):
  run notepad
  Sleep 3000
  run cmd
  ; But leave the rest below unchanged.
 if not KeepWinZRunning ; The user signaled the loop to stop by pressing Win-Z again.
  break ; Break out of this loop.
}
KeepWinZRunning := false ; Reset in preparation for the next press of this hotkey.
return ;表示这个快捷键的作用到此处结束,如果注释,则会继续执行下面的命令
#d::msgbox,hi
#p::Pause ;可以把不想被执行的快捷键定义放在后面,此时可以按快捷键执行。
#c::
run calc
run cmd
return

No comments:

Post a Comment