有人可以帮我一个AutoHotKey脚本吗?

时间:2012-05-31 03:34:36

标签: autohotkey

我已经阅读了它的帮助和指南,但我无法弄明白。我想做的就是创建一个热键,当按下该键时将移动鼠标,直到再次按下热键。谁能告诉我怎么做?它应该很简单,但显然我错过了一些东西。

2 个答案:

答案 0 :(得分:3)

这几乎是最烦人的HotKey,但是你去了(热键是 Ctrl + Alt + C );

#MaxThreadsPerHotkey 3
^!c::
#MaxThreadsPerHotkey 1
if DoMouseMove
{
   DoMouseMove := false
   return
}

DoMouseMove := true
Loop
{
   Sleep 100
   Random, randX, 1, 1028
   Random, randY, 1, 800
   MouseMove, randX, randY, 25
   Sleep, 100

   if not DoMouseMove 
      break
}
DoMouseMove := false
return

答案 1 :(得分:0)

我会投入我的解决方案。

pause::
If (Toggle := !Toggle) ; Toggle the value True/False
    {
        ToolTip Mouse Mover,A_ScreenWidth/2,0 ; Show that Mouse Mover is active
        SetTimer MoveMouse, 1000 ; 1000 ms = 1 sec. Every minute (60000 ms) is probably enough.
    }
Else
    {
        Tooltip ;  Turn Mouse Mover alert window off
        SetTimer MoveMouse, Off ; Turn the timer off
    }
return

MoveMouse:
    MouseMove, 1, 0, 1, R ;Move the mouse one pixel to the right
    Sleep, 50 ; Wait 50 ms. Not realy required, but makes the move visible
    MouseMove, -1, 0, 1, R ;Move the mouse back one pixel
return