3
3
import re
4
4
import time
5
5
from enum import Enum
6
- from PyQt5 .QtWidgets import *
7
- from PyQt5 .QtGui import *
6
+ from PySide2 .QtWidgets import *
7
+ from PySide2 .QtGui import *
8
8
from xtool import Ui_MainWindow
9
9
import pyautogui
10
10
11
11
if platform .system () == "Windows" :
12
12
import ctypes
13
- ctypes .windll .shell32 .SetCurrentProcessExplicitAppUserModelID ("myappid " )
13
+ ctypes .windll .shell32 .SetCurrentProcessExplicitAppUserModelID ("wxtool " )
14
14
15
15
16
16
# 号码状态
@@ -101,6 +101,7 @@ def start_invite(self):
101
101
continue
102
102
try :
103
103
state = self .add_friend (friend_info ["phone" ])
104
+ friend_info ["state" ] = state
104
105
except RuntimeError as e :
105
106
QMessageBox .warning (self , "错误" , str (e ))
106
107
return
@@ -132,7 +133,7 @@ def add_friend(phone):
132
133
retry = 5
133
134
# 查找用户
134
135
while retry > 0 :
135
- time .sleep (1 )
136
+ time .sleep (0.5 )
136
137
retry = retry - 1
137
138
search_result = pyautogui .locateCenterOnScreen ('./stepPic/search_result.png' , confidence = 0.9 )
138
139
if not search_result :
@@ -156,11 +157,23 @@ def add_friend(phone):
156
157
else :
157
158
raise RuntimeError ("未知错误" )
158
159
pyautogui .click (add )
159
- send = pyautogui .locateCenterOnScreen ('./stepPic/send.png' , confidence = 0.9 )
160
- if not send :
161
- raise RuntimeError ("未找到发送按钮" )
162
- pyautogui .click (send )
163
- time .sleep (1 )
160
+ send_retry = 5
161
+ while send_retry > 0 :
162
+ time .sleep (0.5 )
163
+ send_retry = send_retry - 1
164
+ send = pyautogui .locateCenterOnScreen ('./stepPic/send.png' , confidence = 0.9 )
165
+ if send :
166
+ pyautogui .click (send )
167
+ break
168
+ elif send_retry == 0 :
169
+ raise RuntimeError ("未找到发送按钮" )
170
+ send_result_retry = 5
171
+ while send_result_retry > 0 :
172
+ time .sleep (0.5 )
173
+ send_result_retry = send_result_retry - 1
174
+ send_result = pyautogui .locateCenterOnScreen ('./stepPic/send_result.png' , confidence = 0.9 )
175
+ if send_result :
176
+ break
164
177
return PhoneState .Succeed
165
178
166
179
def main ():
0 commit comments