Advertisement
Guest User

Untitled

a guest
Dec 14th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
  2. ; #Warn ; Enable warnings to assist with detecting common errors.
  3. SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
  4. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
  5.  
  6. fire := 0
  7. xpos = 0
  8. ypos = 0
  9.  
  10. F2::
  11. MouseGetPos, xpos, ypos ; remember the mouse position when auto-firing
  12. SetTimer, AutoFire, % (fire := !fire) ? "100" : "Off"
  13. return
  14.  
  15. AutoFire:
  16. Click, left, %xpos%, %ypos%
  17. ;ControlClick, X%xpos% Y%ypos%, ahk_class ApplicationFrameWindow,,,, Pos
  18. ;ControlClick, x500 y500, A,,,, Pos; position relative to upper left corner of window!
  19. return
  20.  
  21. ShowSavedMousePos:
  22. MsgBox, The cursor is at X%xpos% Y%ypos%.
  23. return
  24.  
  25. PostClick(x,y,win="A") {
  26. lParam := x & 0xFFFF | (y & 0xFFFF) << 16
  27. PostMessage, 0x201, , %lParam%, , %win% ;WM_LBUTTONDOWN
  28. PostMessage, 0x202, , %lParam%, , %win% ;WM_LBUTTONUP
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement