ランダムに2人を選んでごみを捨ててQQプログラムに送ります
1335 ワード
import win32gui
import win32con
import win32clipboard as w
import random
import time
def getText():
""" """
w.OpenClipboard()
d = w.GetClipboardData(win32con.CF_UNICODETEXT)
w.CloseClipboard()
return d
def setText(aString):
""" """
w.OpenClipboard()
w.EmptyClipboard()
w.SetClipboardData(win32con.CF_UNICODETEXT, aString)
w.CloseClipboard()
def send_qq(to_who, msg):
""" qq
to_who:qq
msg:
"""
#
setText(msg)
print(getText())
# qq
qq = win32gui.FindWindow(None, to_who)
# QQ
win32gui.SendMessage(qq, 258, 22, 2080193)
win32gui.SendMessage(qq, 770, 0, 0)
#
win32gui.SendMessage(qq, win32con.WM_KEYDOWN, win32con.VK_RETURN, 0)
win32gui.SendMessage(qq, win32con.WM_KEYUP, win32con.VK_RETURN, 0)
if __name__ == '__main__':
#
list = ["A","B","C","D","E","F","G","H"]
rengfan = random.sample(list, 2)
str = ','.join(rengfan)
time = time.strftime('%Y.%m.%d %H:%M:%S ',time.localtime(time.time()))
message = (" : "+ str+"。
:" + time)
to_who=' '
msg=message
send_qq(to_who, msg)