Advertisement
bystander36

Alt Tab

Jan 3rd, 2018
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.59 KB | None | 0 0
  1. function OnEvent(event, arg)
  2.     if (event == "MOUSE_BUTTON_PRESSED" and arg == 4) then
  3.         PressKey("lalt")
  4.         Sleep(10)
  5.         repeat
  6.             PressAndReleaseKey("tab")
  7.             ReturnCode = SleepMouseButtonBreak(320, 4)
  8.         until not IsMouseButtonPressed(4) or ReturnCode == _MOUSE_BUTTON_BREAK
  9.         ReleaseKey("lalt")
  10.     end
  11. end
  12.  
  13. _TIME_BREAK = 0
  14. _MOUSE_BUTTON_BREAK = 1
  15. function SleepMouseButtonBreak(time, mb)
  16.     StartTime = GetRunningTime()
  17.     while (GetRunningTime() - StartTime) < time do
  18.         if not IsMouseButtonPressed(mb) then
  19.             return _MOUSE_BUTTON_BREAK
  20.         end
  21.         Sleep(10)
  22.     end
  23.     return _TIME_BREAK
  24. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement