1 (изменено: nikolay281644, 2013-09-20 18:17:33)

Тема: AHK:Назначить кнопку активации скрипта.

Есть скрипт :
#NoEnv
SendMode Input

_auto := true ;Toggle for the anti-recoil being on or off. default is on

~LButton::autofire() ; When the LButton is pressed run the autofire() function
+LButton::_auto := ! _auto ;Shift + LButton used to toggle the anti-recoil on and off
F1::ExitApp ; F1 used to exit the ahk script file

; autofire() function, name is misleading could easily be antiRecoil()
autofire()
{
  global _auto
  if _auto ; if _auto == true. i.e. is anti-recoil on?
  { ; anti-recoil on?  If yes do this
    Loop ; Continuously loop until a 'break' command
    {
      if GetKeyState("LButton", "P") ; If LButton is pressed
      { ; LButton pressed? If yes do this
        Sleep 85 ; sleep for 85 milliseconds
        mouseXY(0, 6) ;Call the mouseXY() function which moves the mouse the specified distance. mouseXY( X, Y,)
        Sleep 45 ; sleep for 45milliseconds
      }
      else ;LButton pressed? If no do this, i.e. exit the loop
        break ;will stop the loop
    } ;; loop
  } ;; if
} ;; autofire() ; anti-recoil on? If no do nothing

mouseXY(x,y)
{
  DllCall("mouse_event",uint,1,int,x,int,y,uint,0,int,0) ; moves the mouse could easily be the built in autohotkey MouseMove, X, Y
}




ПОдскажите, на какую кнопку его запускать( он запускается сразу, как запустишь) и как его выключать.
Также подскажите, я бы хотел сделать так, чтобы на F2 он запускался, и на F2 останавливался, или на CAPSLOCK. В общем как изменить в скрипте, чтобы назначить кнопку OFF и ON

Заранее спасибо.

2

Re: AHK:Назначить кнопку активации скрипта.

И название темы должно начинатся с большой буквы, и отражать её суть.

По вопросам возмездной помощи пишите на E-Mail: serzh82saratov@mail.ru Telegram: https://t.me/sergiol982
Win10x64 AhkSpy, Hotkey, ClockGui

3

Re: AHK:Назначить кнопку активации скрипта.

Надеюсь этот пример вам поможет.

pause
loop, {
    Msgbox Проверка работоспособности.
    sleep, 5000
    }
f2::pause