Advertisement
Guest User

autohotkey spam z to background window

a guest
Oct 23rd, 2014
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. ;1. toggle on with f11
  2. ;2. capture window with f12
  3. ;3. toggle off with f11
  4. ;redo from 1 if you want to start again
  5. #NoEnv
  6. #Persistent,On
  7. #SingleInstance,Force
  8. SetWinDelay,0
  9. SetControlDelay,0
  10. SetBatchLines,-1
  11. SendMode,Input
  12. ;SetKeyDelay,0
  13.  
  14. hotkeys=z
  15. toggle=1
  16.  
  17. DOLOOP:
  18. If(toggle = 1)
  19. {
  20. Loop
  21. {
  22. if(toggle=0)
  23. break
  24. ControlSend,%ctrl%,{z},ahk_id %win%
  25. ControlSend,%ctrl%,{z DOWN},ahk_id %win%
  26. sleep,1
  27. }
  28. }
  29. Return
  30.  
  31. F11::
  32. toggle := !toggle
  33. TrayTip,%toggle%,-,2
  34. Return
  35.  
  36. F12::
  37. win:=WinExist("A")
  38. Loop
  39. {
  40. parent:=DllCall("GetParent",UInt,win)
  41. If parent=0
  42. Break
  43. win:=parent
  44. }
  45.  
  46. ControlGetFocus,ctrl,ahk_id %win%
  47. winGetClass,class,ahk_id %win%
  48. TrayTip,%class% %ctrl% %win%,3,3
  49. GoSub,DOLOOP
  50. Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement