Skip to content

Instantly share code, notes, and snippets.

@iwatake2222
Created December 14, 2017 14:23
Show Gist options
  • Save iwatake2222/7e6790f760433133427fe6c8e7c574bc to your computer and use it in GitHub Desktop.
Save iwatake2222/7e6790f760433133427fe6c8e7c574bc to your computer and use it in GitHub Desktop.
1秒おきにアクティブwindowをランダムに切り替える。 チャットなどの無操作オフライン防止
# -*- coding: utf-8 -*-
import sys
import os
import time
import pyautogui
import random
###
# Main
###
def main():
while 1:
time.sleep(1)
n = random.randint(1,10)
print(n)
pyautogui.keyDown('alt')
for i in range(n):
pyautogui.keyDown('tab')
pyautogui.keyUp('tab')
pyautogui.keyUp('alt')
###
# Main
###
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment