1 (изменено: Untiy1, 2012-04-29 21:46:14)

Тема: AHK: Кликер

Доброго времени суток.
Мне нужен скрипт который при нажатой кнопке мыши будет много раз кликать с интервалом в 30 милисекунд, а когда отпускаю мышь - переставал

С этим разобрался.

Теперь у меня другой вопрос: нужно сделать чтоб скрипт запускался выключенным

2 (изменено: InFlames, 2012-04-29 22:27:45)

Re: AHK: Кликер

Untiy1 пишет:

Доброго времени суток.
Теперь у меня другой вопрос: нужно сделать чтоб скрипт запускался выключенным

return

перед основной частью кода.
А основную часть кода - запускать с хоткея.

var=MSG
return
F1::
msgbox %var%
return

Или

pause

3 (изменено: Untiy1, 2012-04-30 01:28:36)

Re: AHK: Кликер

Я написал простенький автокликер. Когда держишь кнопку мыши он имитирует многократные нажатия

 LButton::

   Loop
      {
         Send, {LButton}
         Sleep, 1               
         If GetKeyState("LButton", "P") = 0
            Break
      }
   Return

Но есть проблема: в игре он тормозит, происходят непонятные задержки между кликами.

У меня есть многофункциональный скрипт. Он работает нормально, не тормозит. Помогите вытащить из него автокликер.

 ; <COMPILER: v1.0.48.5>
#NoEnv
#SingleInstance Ignore
SetBatchLines -1
#InstallKeybdHook
#InstallMouseHook
#NoTrayIcon


n = 0
_af = 0

gosub, CreateIni
gosub, ReadIni
gosub, GuiBuild
return





GuiBuild:
 gui, font, s10
 Gui, add, tab,, General|Advanced|Binds
 Gui, Tab, 1qq
 Gui, Add, Text,, Which mode do U prefer?
 gui, add, dropdownlist, gSelModes vMode, SVD|SSG-69||PSG|Shotgun|None
 gui, add, checkbox, g_autofire v_af, Autoclicker
 Gui, Add, Checkbox, x190 y66 gSelModes v_nob, Silver
 guicontrol,, _nob, %_nob%
 Gui, Add, Checkbox, x190 y50 w90 gSelModes v_coupon, Быстрая смена оружия
 Gui, Add, Text, x160 y125, © by Timekiller
 gui, tab, 2
 gui, add, text, x30 y40, QuickScopeShot Delay
 gui, add, edit, x180 y40 w20 h20 gSelModes v_fzd, % _fzd
 guicontrol,, _fzd, %_fzd%
 gui, add, text, x205 y43, мс
 gui, add, text, x30 y70, ShotgunReShot Delay
 gui, add, edit, x180 y70 w30 h20 gSelModes v_shotgund, % _shotgund
 guicontrol,, _shotgund, %_shotgund%
 guicontrol, hide, _coupon
 gui, add, text, x213 y72, мс
 gui, add, button, x30 y100 gDefaultIni, Set as Default
 Gui, Add, Text, x160 y125, © by Timekiller
 gui, tab, 3
 gui, add, text, x30 y45, QuickScopeKey
 gui, add, button, x150 y39 gmodkey1, Set
 gui, add, text, x30 y80, SwitchShotKey
 gui, add, button, x150 y76 gmodkey2, Set
 Gui, Add, Text, x160 y125, © by Timekiller
 Gui, Show, w280 h150, PB Scripts Utility v1.1
 gosub, SelModes
return

SelModes:
 gui, submit, nohide
 if Mode = None
 {
  msgbox All activated scripts have been stopped
  hotkey, %qsskey%, qss, off
  hotkey, %sskey%, ss, off
 }
 else
 {
  hotkey, ~*%qsskey%, qss, on
  hotkey, ~*%sskey%, ss, on
 }
 hotkey, $~*%autoshotkey%, _autofire, off
 if Mode = SSG-69
 {
  guicontrol, show, _nob
  if _nob = 1
   bullets = 7
  else
   bullets = 5
 }
 else
  guicontrol, hide, _nob
 if (Mode = "Shotgun" and _shotgund = 650) or (Mode = "Shotgun" and _shotgund = 425)
 {
  guicontrol, show, _coupon
  if _coupon = 1
   guicontrol,, _shotgund, 425
  else
   guicontrol,, _shotgund, 650
 }
 else
  guicontrol, hide, _coupon
return

GuiClose:
 gosub, UpdateIni
 ExitApp
return





modkey1:
 gui, 2:destroy
 gui, 2: -sysmenu
 gui, 2: font, s10
 gui, 2: add, text, x25 y15, Hotkey:
 gui, 2: add, edit, x85 y13 w80 h20 disabled, %qsskey%
 gui, 2: add, button, x15 y45 w80 h25 gmousekey1, Mouse Keys
 gui, 2: add, button, x100 y45 w85 h25 gkeybd1, Keybd Keys
 gui, 2: add, button, x73 y72 w50 h25 gcancel1, Cancel
 gui, 2: show, w200 h100, Set Hotkey
return

modkey2:
 gui, 3:destroy
 gui, 3: -sysmenu
 gui, 3: font, s10
 gui, 3: add, text, x25 y15, Hotkey:
 gui, 3: add, edit, x85 y13 w80 h20 disabled, %sskey%
 gui, 3: add, button, x15 y45 w80 h25 gmousekey2, Mouse Keys
 gui, 3: add, button, x100 y45 w85 h25 gkeybd2, Keybd Keys
 gui, 3: add, button, x73 y72 w50 h25 gcancel2, Cancel
 gui, 3: show, w200 h100, Set Hotkey
return

keybd1:
 gui, 21: -sysmenu alwaysontop
 gui, 21: font, s10
 gui, 21: add, hotkey, x15 y13 w100 h20 limit176 vqsskey
 gui, 21: add, button, x40 y40 gsubmition21, Save
 gui, 21: show, xcenter ycenter, Press Any Key
return

submition21:
 gui, 21: submit
 IniWrite, %qsskey%, %A_ProgramFiles%\PBScrUtil\PBScrUtil.ini, HOTKEYS, qsskey
 gui, 21: destroy
 gui, 2: destroy
return

keybd2:
 gui, 31: -sysmenu alwaysontop
 gui, 31: font, s10
 gui, 31: add, hotkey, x15 y13 w100 h20 limit176 vsskey
 gui, 31: add, button, x40 y40 gsubmition31, Save
 gui, 31: show, xcenter ycenter, Press Any Key
return

submition31:
 gui, 31: submit
 IniWrite, %sskey%, %A_ProgramFiles%\PBScrUtil\PBScrUtil.ini, HOTKEYS, sskey
 gui, 31: destroy
 gui, 3: destroy
return

mousekey1:
 gui, 22: -sysmenu alwaysontop
 gui, 22: font, s10
 gui, 22: add, button, gsub221, LeftMouseButton
 gui, 22: add, button, gsub222, RightMouseButton
 gui, 22: add, button, gsub223, MiddleMouseButton
 gui, 22: add, button, gsub224, ExtraMouseButton1
 gui, 22: add, button, gsub225, ExtraMouseButton2
 gui, 22: show,, Choose Mouse Key
return

mousekey2:
 gui, 32: -sysmenu alwaysontop
 gui, 32: font, s10
 gui, 32: add, button, gsub321, LeftMouseButton
 gui, 32: add, button, gsub322, RightMouseButton
 gui, 32: add, button, gsub323, MiddleMouseButton
 gui, 32: add, button, gsub324, ExtraMouseButton1
 gui, 32: add, button, gsub325, ExtraMouseButton2
 gui, 32: show,, Choose Mouse Key
return

sub221:
 gui, 22: submit
 qsskey = LButton
 IniWrite, %qsskey%, %A_ProgramFiles%\PBScrUtil\PBScrUtil.ini, HOTKEYS, qsskey
 gui, 22: destroy
 gui, 2: destroy
return

sub222:
 gui, 22: submit
 qsskey = RButton
 IniWrite, %qsskey%, %A_ProgramFiles%\PBScrUtil\PBScrUtil.ini, HOTKEYS, qsskey
 gui, 22: destroy
 gui, 2: destroy
return

sub223:
 gui, 22: submit
 qsskey = MButton
 IniWrite, %qsskey%, %A_ProgramFiles%\PBScrUtil\PBScrUtil.ini, HOTKEYS, qsskey
 gui, 22: destroy
 gui, 2: destroy
return

sub224:
 gui, 22: submit
 qsskey = XButton1
 IniWrite, %qsskey%, %A_ProgramFiles%\PBScrUtil\PBScrUtil.ini, HOTKEYS, qsskey
 gui, 22: destroy
 gui, 2: destroy
return

sub225:
 gui, 22: submit
 qsskey = XButton2
 IniWrite, %qsskey%, %A_ProgramFiles%\PBScrUtil\PBScrUtil.ini, HOTKEYS, qsskey
 gui, 22: destroy
 gui, 2: destroy
return

sub321:
 gui, 32: submit
 sskey = LButton
 IniWrite, %sskey%, %A_ProgramFiles%\PBScrUtil\PBScrUtil.ini, HOTKEYS, sskey
 gui, 32: destroy
 gui, 3: destroy
return

sub322:
 gui, 32: submit
 sskey = RButton
 IniWrite, %sskey%, %A_ProgramFiles%\PBScrUtil\PBScrUtil.ini, HOTKEYS, sskey
 gui, 32: destroy
 gui, 3: destroy
return

sub323:
 gui, 32: submit
 sskey = MButton
 IniWrite, %sskey%, %A_ProgramFiles%\PBScrUtil\PBScrUtil.ini, HOTKEYS, sskey
 gui, 32: destroy
 gui, 3: destroy
return

sub324:
 gui, 32: submit
 sskey = XButton1
 IniWrite, %sskey%, %A_ProgramFiles%\PBScrUtil\PBScrUtil.ini, HOTKEYS, sskey
 gui, 32: destroy
 gui, 3: destroy
return

sub325:
 gui, 32: submit
 sskey = XButton2
 IniWrite, %sskey%, %A_ProgramFiles%\PBScrUtil\PBScrUtil.ini, HOTKEYS, sskey
 gui, 32: destroy
 gui, 3: destroy
return

cancel1:
 gui, 2: destroy
return

cancel2:
 gui, 3: destroy
return





CreateIni:
 IfNotExist, %A_ProgramFiles%\PBScrUtil
  FileCreateDir, %A_ProgramFiles%\PBScrUtil
 IfNotExist %A_ProgramFiles%\PBScrUtil\PBScrUtil.ini
 {
  IniWrite, vk01, %A_ProgramFiles%\PBScrUtil\PBScrUtil.ini, HOTKEYS, autoshotkey
  IniWrite, vk45, %A_ProgramFiles%\PBScrUtil\PBScrUtil.ini, HOTKEYS, qsskey
  IniWrite, vk56, %A_ProgramFiles%\PBScrUtil\PBScrUtil.ini, HOTKEYS, sskey
  IniWrite, 0, %A_ProgramFiles%\PBScrUtil\PBScrUtil.ini, SETTINGS, _nob
  IniWrite, 0, %A_ProgramFiles%\PBScrUtil\PBScrUtil.ini, SETTINGS, _coupon
  IniWrite, 25, %A_ProgramFiles%\PBScrUtil\PBScrUtil.ini, VAR, _fzd
  IniWrite, 650, %A_ProgramFiles%\PBScrUtil\PBScrUtil.ini, VAR, _shotgund
 }
return

ReadIni:
 IniRead, autoshotkey, %A_ProgramFiles%\PBScrUtil\PBScrUtil.ini, HOTKEYS, autoshotkey
 IniRead, qsskey, %A_ProgramFiles%\PBScrUtil\PBScrUtil.ini, HOTKEYS, qsskey
 IniRead, sskey, %A_ProgramFiles%\PBScrUtil\PBScrUtil.ini, HOTKEYS, sskey
 IniRead, _nob, %A_ProgramFiles%\PBScrUtil\PBScrUtil.ini, SETTINGS, _nob
 IniRead, _coupon, %A_ProgramFiles%\PBScrUtil\PBScrUtil.ini, SETTINGS, _coupon
 IniRead, _fzd, %A_ProgramFiles%\PBScrUtil\PBScrUtil.ini, VAR, _fzd
 IniRead, _shotgund, %A_ProgramFiles%\PBScrUtil\PBScrUtil.ini, VAR, _shotgund
return

UpdateIni:
 gui, submit, nohide
 IniWrite, %autoshotkey%, %A_ProgramFiles%\PBScrUtil\PBScrUtil.ini, HOTKEYS, autoshotkey
 IniWrite, %qsskey%, %A_ProgramFiles%\PBScrUtil\PBScrUtil.ini, HOTKEYS, qsskey
 IniWrite, %sskey%, %A_ProgramFiles%\PBScrUtil\PBScrUtil.ini, HOTKEYS, sskey
 IniWrite, %_nob%, %A_ProgramFiles%\PBScrUtil\PBScrUtil.ini, SETTINGS, _nob
 IniWrite, %_coupon%, %A_ProgramFiles%\PBScrUtil\PBScrUtil.ini, SETTINGS, _coupon
 IniWrite, %_fzd%, %A_ProgramFiles%\PBScrUtil\PBScrUtil.ini, VAR, _fzd
 IniWrite, %_shotgund%, %A_ProgramFiles%\PBScrUtil\PBScrUtil.ini, VAR, _shotgund
return

DefaultIni:
 IniWrite, vk01, %A_ProgramFiles%\PBScrUtil\PBScrUtil.ini, HOTKEYS, autoshotkey
 IniWrite, vk45, %A_ProgramFiles%\PBScrUtil\PBScrUtil.ini, HOTKEYS, qsskey
 IniWrite, vk56, %A_ProgramFiles%\PBScrUtil\PBScrUtil.ini, HOTKEYS, sskey
 IniWrite, 0, %A_ProgramFiles%\PBScrUtil\PBScrUtil.ini, SETTINGS, _nob
 IniWrite, 0, %A_ProgramFiles%\PBScrUtil\PBScrUtil.ini, SETTINGS, _coupon
 IniWrite, 25, %A_ProgramFiles%\PBScrUtil\PBScrUtil.ini, VAR, _fzd
 IniWrite, 650, %A_ProgramFiles%\PBScrUtil\PBScrUtil.ini, VAR, _shotgund
 reload
return





^vk6d::
 suspend
 goto, suspend_sound
return

ins::
 guicontrol, choosestring, Mode, SSG-69
 gui, submit, nohide
return

home::
 guicontrol, choosestring, Mode, Shotgun
 goto, SelModes
return

vk6d::
 _afs := _af = 0 ? "1" : "0"
 guicontrol,, _af, %_afs%
 goto, _autofire
return





_autofire:
gui, submit, nohide
if _af = 1
{
 soundbeep,,300
 hotkey, %autoshotkey%, _autofire1, on
}
else
{
 soundbeep,1000,300
 hotkey, %autoshotkey%, _autofire1, off
}
return

_autofire1:
 if _af = 1
 {
  while GetKeyState("vk01", "P")
  {
   MouseClick, left, , , 1, 99, D
   Sleep 32
   MouseClick, left, , , 1, 99, U
   Sleep 28
  }
 }
 Return





qss:
   Thread, Priority, 1000
   if Mode = SVD
   {
      MouseClick, right, , , 1, , D
      Sleep 25
      MouseClick, right, , , 1, , U
      Sleep %_fzd%
      MouseClick, left, , , 1, , D
      Sleep 20
      MouseClick, left, , , 1, , U
      Sleep 20
      MouseClick, right, , , 1, , D
      Sleep 20
      MouseClick, right, , , 1, , U
      Sleep 20
   }

   if Mode = PSG
   {
      MouseClick, right, , , 1, , D
      Sleep 25
      MouseClick, right, , , 1, , U
      Sleep %_fzd%
      MouseClick, left, , , 1, , D
      Sleep 20
      MouseClick, left, , , 1, , U
      Sleep 20
      MouseClick, right, , , 1, , D
      Sleep 20
      MouseClick, right, , , 1, , U
      Sleep 20
      MouseClick, right, , , 1, , D
      Sleep 20
      MouseClick, right, , , 1, , U
      Sleep 20
   }

   if Mode = SSG-69
   {
      MouseClick, right, , , 1, , D
      Sleep 25
      MouseClick, right, , , 1, , U
      Sleep %_fzd%
      MouseClick, left, , , 1, , D
      Sleep 20
      MouseClick, left, , , 1, , U
      Sleep 20
      send {vk51 down}
      sleep 20
      send {vk51 up}
      sleep 20
      send {vk51 down}
      sleep 20
      send {vk51 up}
      n += 1
      goto, reload_sound
   }
   Return

ss:
   Thread, Priority, 1000
   if Mode = SSG-69
   {
      MouseClick, left, , , 1, , D
      Sleep 20
      MouseClick, left, , , 1, , U
      Sleep 20
      send {vk51 down}
      sleep 20
      send {vk51 up}
      sleep 20
      send {vk51 down}
      sleep 20
      send {vk51 up}
      n += 1
      goto, reload_sound
   }

   if Mode = Shotgun
   {
    while GetKeyState(substr(a_thishotkey, 3), "P")
    {
      MouseClick, left, , , 1, , D
      Sleep 20
      MouseClick, left, , , 1, , U
      Sleep 20
      send {vk51 down}
      sleep 20
      send {vk51 up}
      sleep 20
      send {vk51 down}
      sleep 20
      send {vk51 up}
      sleep %_shotgund%
    }
   }
return





SayToTeam:
   SetKeyDelay, 0
   Send {F3 Down}
   sleep 50
   Send {F3 Up}
   sleep 50
   Send %Message%
   sleep 50
   send {Enter up}
   sleep 30
   Send {Enter Down}
Return

SayToAll:
   SetKeyDelay, 0
   send {lalt down}{lshift}{lalt up}
   sleep 50
   Send {F2 Down}
   sleep 30
   Send {F2 Up}
   sleep 50
   Send %Message1%
   sleep 50
   send {Enter up}
   sleep 30
   Send {Enter Down}
   sleep 30
   send {lalt down}{lshift}{lalt up}
Return

*vk60::
 Message := "ИДУТ С КРЫШИ"
 goto, SayToTeam
Return

*vk61::
 Message := "ИДУТ СНИЗУ СЛЕВА"
 goto, SayToTeam
Return

*vk63::
 Message := "ИДУТ СНИЗУ СПРАВА"
 goto, SayToTeam
Return

*vk65::
 Message := "ИДУТ ПО ЦЕНТРУ"
 goto, SayToTeam
Return

*vk64::
 Message := "ИДУТ СЛЕВОГО КРАЯ"
 goto, SayToTeam
Return

*vk66::
 Message := "ИДУТ СПРАВОГО КРАЯ"
 goto, SayToTeam
Return

*vk6B::
 Message1 := "Nice Shot"
 goto, SayToAll
Return





*~vk52::
 n = 0
Return

reload_sound:
{
 if n = %bullets%
 {
  SoundPlay *48
  n = 0
 }
Return
}

suspend_sound:
If (A_IsSuspended = 0)
 soundbeep,,300
return

4

Re: AHK: Кликер

Вероятно с 358-й строки по 369-ю находиться искомый автокликер
В «многофункциональном скрипте» используется задержка не менее 20 мс между кликами.

5

Re: AHK: Кликер

Я в моем тоже ставил 20мс и он глючил, а этот работает нормально.
Можете достать оттуда автокликер чтоб он работал?

6 (изменено: Untiy1, 2012-04-30 12:57:36)

Re: AHK: Кликер

Вроде разобрался но не пойму что значат строки начиная с left. Без них идут задержки между кликами, а сними все нормально.

 MouseClick, left, , , 1, 99, D
   Sleep 32
   MouseClick, left, , , 1, 99, U
   Sleep 28

7

Re: AHK: Кликер

http://www.script-coding.com/AutoHotkey/MouseClick.html

8

Re: AHK: Кликер

Всем спасибо за помощь

9 (изменено: Untiy, 2012-05-01 22:43:17)

Re: AHK: Кликер

Вопрос. Как назначить одно и тоже действие на несколько кнопок?

LButton::   
_autofire1:

 
  while GetKeyState("vk01", "P")
  {
   MouseClick, left, , , 1, 99, D
   Sleep 62
   MouseClick, left, , , 1, 99, U
   Sleep 58
  
 }
return

Нужно чтоб он срабатывал на клик мышью и на ctrl+клик мышью

10

Re: AHK: Кликер

*LButton::
    while GetKeyState("vk01", "P")
    {
        MouseClick, left,,, 1, 99, D
        Sleep 62
        MouseClick, left,,, 1, 99, U
        Sleep 58
    }
    return

AutoHotkeyTranslation :: ahk-l docs

11

Re: AHK: Кликер

creature.ws пишет:
*LButton::
    while GetKeyState("vk01", "P")
    {
        MouseClick, left,,, 1, 99, D
        Sleep 62
        MouseClick, left,,, 1, 99, U
        Sleep 58
    }
    return

AutoHotkeyTranslation :: ahk-l docs

Я так понял теперь он срабатывает с любой клавишей +LButton
Спасибо большое!

12 (изменено: EV, 2020-05-24 17:48:01)

Re: AHK: Кликер

toggle = 0
#MaxThreadsPerHotkey 2

F3::
    Toggle := !Toggle
     While Toggle{
        click
        sleep 100
    }
return