项目初衷为使用pyautogui模拟@微信里的人。不得不用typewriter,因汉字无法直接输入,那么就曲线救国。
步骤如下

import pypinyin
# 不带声调的(style=pypinyin.NORMAL)
def pinyin(word):
s = ''
for i in pypinyin.pinyin(word, style=pypinyin.NORMAL):
s += ''.join(i)
return s
def Aite(self,list):
'''
此处为@人的操作
'''
auto.hotkey("ctrl", "shift","1") # 切换至搜狗输入法中文模式
for i in list:
auto.hotkey("shift", "2")
time.sleep(0.1)
auto.typewrite(pinyin(i),0.1)
auto.typewrite(' ')
# time.sleep(0.2)
wechat_locate7 = auto.locateCenterOnScreen(self.wechat_locate7_address)
auto.click(wechat_locate7.x, wechat_locate7.y) # 偏移点人
说白了 就是模拟搜狗输入法挨个输字母然后敲空格










