Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use Python to batch verify and add mobile phone number to WeCom contact

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly explains "how to use Python batch verification and add mobile phone number for WeCom contact", the content of the article is simple and clear, easy to learn and understand, now please follow the editor's train of thought slowly in depth, together to study and learn "how to use Python batch verification and add mobile phone number for WeCom contact" bar!

Catalogue

Demand

Source code

Running

Demand

Batch verify and add contacts whose mobile phone number is WeCom account

Source code import tkinter as tkimport pyautogui as pgimport tkinter.messagebox as msgbox def setpos (): global XMagi y try: XMagi y = eval (tEntry.get ()) except: pass pg.click (Xmure 150Peni y) pg.typewrite ('1') pg.moveTo (Xmemy Magazine 0.5) def alter (num): tList.delete (index) tList.insert (index,phone+','+str (num)) user [index] = phone+' '+ str (num) with open ("phones.txt", "w", encoding= "utf-8") as f: f.write ('\ n'.join (user)) def flag0 (): alter (0) def flag1 (): alter (1) def flag2 (): alter (2) def start (): global x Y0 = pg.position () lines = len (user) index =-1 for i in user: index + = 1 if len (I) = 11:break phone = user [index] if len (phone) > 11: msgbox.showinfo ('prompt', 'mobile number is greater than 11 digits Or end it all!') Else: try: t = tList.curselection () [0] tList.select_clear (tMagne t) except: pass tList.select_set (index,index) pg.click (Xmuri 150Lay y) pg.typewrite ('\ baukeye 50) pg.typewrite (phone) pg.moveTo (XMJ y Duration=0.5) pg.click () pg.moveTo (x0pedagy 0) def main ():''written by hannyang 2021.10.16 friends' global tEntry,tList global user root = tk.Tk () root.geometry (frank375x323 + {xfu55} + {yMuth85}') root.resizable false, False) root.title ('friends of WeCom') root.wm_attributes ('- topmost'') True) tEntry = tk.Entry (root,width=8) tEntry.place (x = 275,270,27510) bt1 = tk.Button (root,text=' location', command = setpos) bt1.place (x = 220,265) bt2 = tk.Button (root,text=' start', command = start) bt2.place (x = 30, y = 265) bt3 = tk.Button (root,text=' mark 0') Command = flag0) bt3.place (x = 80,265) bt4 = tk.Button (root,text=' mark 1', command = flag1) bt4.place (x = 125,265) bt5 = tk.Button (root,text=' mark 2', command = flag2) bt5.place (x = 170,265) user = [] try: with open ('phones.txt', 'r') Encoding='utf-8') as fn: users = fn.readlines () for usr in users: if usr [- 1] = ='\ n files: usr=usr [:-1] user.append (usr.strip ()) except: user = ['phones.txt file does not exist in the current folder!'] TScroll=tk.Scrollbar (root, orient=tk.VERTICAL) tScroll.place (root, orient=tk.VERTICAL) tScroll.place (tList=tk.Listbox (root,selectmode=tk.BROWSE,yscrollcommand=tScroll.set) tList.place) for i in user: tList.insert (tk.END I) tScroll.config (command=tList.yview) tList.select_set (0Magne0) root.update () tmp = list (set (user)) diff = len (user)-len (tmp) if diffuser 0: msgbox.showinfo ('prompt', there are {diff} duplicate mobile phone numbers! Negligible') root.mainloop () if _ _ name__ = ='_ _ main__': x name__ = pg.size () x = (x-390) / / 2 + 350y = (y-360) / / 2 + 65 main ()

Note: in the last two or three lines of the code, 390360 is the size of the dotted window, and 350 is used to locate coordinates.

The following is the contents of the saved phone text file phones.txt. The mobile phone number has been hidden:

Running

The program does not set up automatic verification and addition, if necessary, save the relevant button screenshots. Jpg picture, and then use functions such as pyautogui.locateCenterOnScreen () to locate, plus loop statements can be achieved.

Thank you for your reading, the above is "how to use Python batch verification and add mobile phone number for WeCom contact" content, after the study of this article, I believe you on how to use Python batch verification and add mobile phone number for WeCom contact this problem has a deeper understanding, the specific use of the situation also needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report