Created
June 21, 2015 10:52
-
-
Save matsub/a42bf1df6af924e2cc70 to your computer and use it in GitHub Desktop.
windows、python用クリッカーです。e(keycode=69)押すと実行/停止の切り替え。waiting中にq(keycode=81)押すと終了。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
import sys | |
import time | |
from ctypes import windll | |
user32 = windll.user32 | |
def detector(keycode=69): | |
return user32.GetKeyState(keycode) | |
def run(delay): | |
print "running" | |
while( detector() ): | |
user32.mouse_event(2, 0, 0, 0, 0) | |
time.sleep(delay) | |
user32.mouse_event(4, 0, 0, 0, 0) | |
def wait(): | |
print "waiting" | |
while( not detector() ): | |
if detector(81): | |
sys.exit(0) | |
time.sleep(0.05) | |
if __name__ == "__main__": | |
while(True): | |
wait() | |
run(0.05) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
めっちゃクリックしなきゃいけないゲームのおともにどうぞ。
e、qを使いたくない時はdetector関数の引数keycodeの既定値69をキーF10(keycode=121)、wait関数中でdetectorに渡してる引数をキーF11(keycode=122)なんかにしてみてね。