tdrpa.tdworker 1.2.13.9__py38-none-win_amd64.whl → 1.2.13.50__py38-none-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tdrpa/tdworker/__init__.pyi +2 -10
- tdrpa/tdworker/{_img.pyi → _other.pyi} +294 -0
- tdrpa/tdworker/_web.pyi +76 -229
- tdrpa/tdworker/_win.pyi +545 -0
- tdrpa/tdworker.cp38-win_amd64.pyd +0 -0
- {tdrpa_tdworker-1.2.13.9.dist-info → tdrpa_tdworker-1.2.13.50.dist-info}/METADATA +2 -2
- {tdrpa_tdworker-1.2.13.9.dist-info → tdrpa_tdworker-1.2.13.50.dist-info}/RECORD +9 -17
- tdrpa/tdworker/_clip.pyi +0 -50
- tdrpa/tdworker/_file.pyi +0 -77
- tdrpa/tdworker/_network.pyi +0 -94
- tdrpa/tdworker/_os.pyi +0 -47
- tdrpa/tdworker/_sp.pyi +0 -21
- tdrpa/tdworker/_w.pyi +0 -129
- tdrpa/tdworker/_winE.pyi +0 -228
- tdrpa/tdworker/_winK.pyi +0 -74
- tdrpa/tdworker/_winM.pyi +0 -117
- {tdrpa_tdworker-1.2.13.9.dist-info → tdrpa_tdworker-1.2.13.50.dist-info}/WHEEL +0 -0
- {tdrpa_tdworker-1.2.13.9.dist-info → tdrpa_tdworker-1.2.13.50.dist-info}/top_level.txt +0 -0
tdrpa/tdworker/__init__.pyi
CHANGED
@@ -1,12 +1,4 @@
|
|
1
|
-
from ._clip import Clipboard as Clipboard
|
2
1
|
from ._excel import Excel as Excel
|
3
|
-
from .
|
4
|
-
from ._img import Image as Image
|
5
|
-
from ._network import HTTP as HTTP, Mail as Mail
|
6
|
-
from ._os import App as App
|
7
|
-
from ._sp import PrintToScreen as PrintToScreen
|
8
|
-
from ._w import Window as Window
|
2
|
+
from ._other import App as App, Clipboard as Clipboard, HTTP as HTTP, INI as INI, Image as Image, Mail as Mail, PrintToScreen as PrintToScreen
|
9
3
|
from ._web import Web as Web, WebPW as WebPW
|
10
|
-
from .
|
11
|
-
from ._winK import WinKeyboard as WinKeyboard
|
12
|
-
from ._winM import WinMouse as WinMouse
|
4
|
+
from ._win import WinElement as WinElement, WinKeyboard as WinKeyboard, WinMouse as WinMouse, Window as Window
|
@@ -1,6 +1,205 @@
|
|
1
1
|
import uiautomation as uia
|
2
2
|
from _typeshed import Incomplete
|
3
3
|
|
4
|
+
class Clipboard:
|
5
|
+
@staticmethod
|
6
|
+
def GetText():
|
7
|
+
"""
|
8
|
+
读取剪贴板文本
|
9
|
+
|
10
|
+
Clipboard.GetText()
|
11
|
+
|
12
|
+
:return:剪贴板的文本内容
|
13
|
+
"""
|
14
|
+
@staticmethod
|
15
|
+
def SaveImage(savePath: str):
|
16
|
+
'''
|
17
|
+
保存剪贴板图像
|
18
|
+
|
19
|
+
Clipboard.SaveImage(savePath)
|
20
|
+
|
21
|
+
:param savePath:[必选参数]要将剪贴板的图像保存到的文件路径,如"D:\\1.png"
|
22
|
+
:return:图像保存成功返回True,保存失败返回False
|
23
|
+
'''
|
24
|
+
@staticmethod
|
25
|
+
def SetFile(paths: str | list):
|
26
|
+
'''
|
27
|
+
文件设置到剪贴板
|
28
|
+
|
29
|
+
Clipboard.SetFile(paths)
|
30
|
+
|
31
|
+
:param paths:[必选参数]文件的路径,单个文件用字符串类型,如"D:\x01.txt",多个文件用 list 类型,其中每个元素用字符串,如["D:\x01.txt", "D:\x01.png"]
|
32
|
+
:return:成功返回True,失败返回False
|
33
|
+
'''
|
34
|
+
@staticmethod
|
35
|
+
def SetImage(picPath):
|
36
|
+
'''
|
37
|
+
图片设置到剪贴板
|
38
|
+
|
39
|
+
Clipboard.SetImage(picPath)
|
40
|
+
|
41
|
+
:param picPath:[必选参数]要放入剪贴板的图片路径,如"D:\\1.png"
|
42
|
+
:return:成功返回True,失败返回False
|
43
|
+
'''
|
44
|
+
@staticmethod
|
45
|
+
def SetText(content: str = ''):
|
46
|
+
'''
|
47
|
+
设置剪贴板文本
|
48
|
+
|
49
|
+
Clipboard.SetText(\'\')
|
50
|
+
|
51
|
+
:param content:[必选参数]新的剪贴板文本内容,默认""
|
52
|
+
:return:成功返回True,失败返回False
|
53
|
+
'''
|
54
|
+
|
55
|
+
class PrintToScreen:
|
56
|
+
@staticmethod
|
57
|
+
def DrawText(msg: str = '', showSec: int = 0) -> None:
|
58
|
+
'''
|
59
|
+
绘制屏幕中央正上方显示的红字
|
60
|
+
|
61
|
+
PrintToScreen.DrawText(\'开始工作\', showSec=0)
|
62
|
+
|
63
|
+
:param msg:[可选参数]文字内容,默认为""
|
64
|
+
:param showSec:[可选参数]显示秒数。0:一直显示到程序结束,大于0:显示的时间,单位是秒
|
65
|
+
:return:无
|
66
|
+
'''
|
67
|
+
@staticmethod
|
68
|
+
def CleanText() -> None:
|
69
|
+
"""
|
70
|
+
清除屏幕中央正上方显示的红字
|
71
|
+
|
72
|
+
PrintToScreen.CleanText()
|
73
|
+
|
74
|
+
:return:无
|
75
|
+
"""
|
76
|
+
|
77
|
+
class INI:
|
78
|
+
@staticmethod
|
79
|
+
def Read(iniPath: str, sectionName: str, keyName: str, defaultValue: str = '', encoding: str = 'GBK') -> str:
|
80
|
+
'''
|
81
|
+
读键值
|
82
|
+
|
83
|
+
value = INI.Read(\'D:\\conf.ini\',\'section1\', \'key1\', defaultValue=\'\', encoding=\'GBK\')
|
84
|
+
|
85
|
+
:param iniPath:[必选参数]INI 配置文件所在路径
|
86
|
+
:param sectionName:[必选参数]要访问 INI 配置文件的小节名字
|
87
|
+
:param keyName:[必选参数]要访问 INI 配置文件的键名
|
88
|
+
:param defaultValue:[可选参数]当 INI 配置文件键名不存在时,返回的默认内容。默认是空字符串
|
89
|
+
:param encoding:[可选参数]文件编码,常用"GBK", "UTF8"等。默认 GBK
|
90
|
+
:return: 返回读取的值,字符串类型
|
91
|
+
'''
|
92
|
+
@staticmethod
|
93
|
+
def Write(iniPath: str, sectionName: str, keyName: str, value, encoding: str = 'GBK') -> None:
|
94
|
+
'''
|
95
|
+
写键值
|
96
|
+
|
97
|
+
INI.Write(\'D:\\conf.ini\',\'section1\', \'key1\', \'value1\', encoding=\'GBK\')
|
98
|
+
|
99
|
+
:param iniPath:[必选参数]INI 配置文件所在路径
|
100
|
+
:param sectionName:[必选参数]要访问 INI 配置文件的小节名字
|
101
|
+
:param keyName:[必选参数]INI 文件中被写入的键值对中的键名,若为空字符串,则此键值对不被写入
|
102
|
+
:param value:[必选参数]INI 文件中被写入的键值对中的键值
|
103
|
+
:param encoding:[可选参数]文件编码,常用"GBK", "UTF8"等。默认 GBK
|
104
|
+
:return: None
|
105
|
+
'''
|
106
|
+
@staticmethod
|
107
|
+
def EnumSection(iniPath: str, encoding: str = 'GBK') -> list:
|
108
|
+
'''
|
109
|
+
枚举小节
|
110
|
+
|
111
|
+
sections = INI.EnumSection(\'D:\\conf.ini\', encoding=\'GBK\')
|
112
|
+
|
113
|
+
:param iniPath:[必选参数]INI 配置文件所在路径
|
114
|
+
:param encoding:[可选参数]文件编码,常用"GBK", "UTF8"等。默认 GBK
|
115
|
+
:return: 返回一个列表,列表中每个元素为一个section的名字
|
116
|
+
'''
|
117
|
+
@staticmethod
|
118
|
+
def EnumKey(iniPath: str, sectionName: str, encoding: str = 'GBK') -> list:
|
119
|
+
'''
|
120
|
+
枚举键
|
121
|
+
|
122
|
+
keys = INI.EnumKey(\'D:\\conf.ini\', \'section1\', encoding=\'GBK\')
|
123
|
+
|
124
|
+
:param iniPath:[必选参数]INI 配置文件所在路径
|
125
|
+
:param sectionName:[必选参数]要访问 INI 配置文件的小节名字
|
126
|
+
:param encoding:[可选参数]文件编码,常用"GBK", "UTF8"等。默认 GBK
|
127
|
+
:return: 返回一个列表,列表中每个元素为一个key的名字
|
128
|
+
'''
|
129
|
+
@staticmethod
|
130
|
+
def DeleteSection(iniPath: str, sectionName: str, encoding: str = 'GBK') -> None:
|
131
|
+
'''
|
132
|
+
删除小节
|
133
|
+
|
134
|
+
INI.DeleteSection(\'D:\\conf.ini\',\'section1\', encoding=\'GBK\')
|
135
|
+
|
136
|
+
:param iniPath:[必选参数]INI 配置文件所在路径
|
137
|
+
:param sectionName:[必选参数]要访问 INI 配置文件的小节名字
|
138
|
+
:param encoding:[可选参数]文件编码,常用"GBK", "UTF8"等。默认 GBK
|
139
|
+
:return: None
|
140
|
+
'''
|
141
|
+
@staticmethod
|
142
|
+
def DeleteKey(iniPath: str, sectionName: str, keyName: str, encoding: str = 'GBK'):
|
143
|
+
'''
|
144
|
+
删除键
|
145
|
+
|
146
|
+
INI.DeleteKey(\'D:\\conf.ini\',\'section1\', \'key1\', encoding=\'GBK\')
|
147
|
+
|
148
|
+
:param iniPath:[必选参数]INI 配置文件所在路径
|
149
|
+
:param sectionName:[必选参数]要访问 INI 配置文件的小节名字
|
150
|
+
:param keyName:[必选参数]要访问 INI 配置文件的键名
|
151
|
+
:param encoding:[可选参数]文件编码,常用"GBK", "UTF8"等。默认 GBK
|
152
|
+
:return: None
|
153
|
+
'''
|
154
|
+
|
155
|
+
class App:
|
156
|
+
@staticmethod
|
157
|
+
def Kill(processName: str | int) -> bool:
|
158
|
+
"""
|
159
|
+
强制停止应用程序的运行(结束进程)
|
160
|
+
|
161
|
+
App.Kill('chrome.exe')
|
162
|
+
|
163
|
+
:param processName:[必选参数]应用程序进程名或进程PID,忽略大小写字母
|
164
|
+
:return:命令执行成功返回True,失败返回False
|
165
|
+
"""
|
166
|
+
@staticmethod
|
167
|
+
def GetStatus(processName: str | int, status: int = 0) -> bool:
|
168
|
+
"""
|
169
|
+
获取应用运行状态
|
170
|
+
|
171
|
+
App.GetStatus('chrome.exe', status=0)
|
172
|
+
|
173
|
+
:param processName:[必选参数]应用程序进程名或进程PID,忽略大小写字母
|
174
|
+
:param status:[可选参数]筛选进程状态。0:所有状态 1:运行 2:暂停 3:未响应 4:未知。默认0
|
175
|
+
:return:进程存在返回True,不存在返回False
|
176
|
+
"""
|
177
|
+
@staticmethod
|
178
|
+
def Run(exePath, waitType: int = 0, showType: int = 1, mode: int = 0):
|
179
|
+
"""
|
180
|
+
启动应用程序
|
181
|
+
|
182
|
+
App.Run('''C:\\Windows\\system32\\mspaint.exe''')
|
183
|
+
|
184
|
+
:param exePath:[必选参数]应用程序文件路径
|
185
|
+
:param waitType:[可选参数]0:不等待 1:等待应用程序准备好 2:等待应用程序执行到退出。默认0
|
186
|
+
:param showType:[可选参数]程序启动后的显示样式(不一定生效) 0:隐藏 1:默认 3:最大化 6:最小化
|
187
|
+
:param mode:[可选参数]启动模式,0:常规模式启动, 1:增强模式启动。当常规模式启动后无法拾取元素时,可尝试增强模式启动。默认0
|
188
|
+
:return:返回应用程序的PID
|
189
|
+
"""
|
190
|
+
@staticmethod
|
191
|
+
def WaitProcess(processName, waitType: str = 'open', delayTime: int = 30000) -> bool:
|
192
|
+
'''
|
193
|
+
等待应用启动或关闭
|
194
|
+
|
195
|
+
App.WaitProcess(\'chrome.exe\', waitType=\'open\', delayTime=30000)
|
196
|
+
|
197
|
+
:param processName:[必选参数]进程名称,忽略大小写字母。如:"chrome.exe"
|
198
|
+
:param waitType:[可选参数]期望应用状态。open:等待应用打开 close:等待应用关闭
|
199
|
+
:param delayTime:[可选参数]最大等待时间,默认30000毫秒(即30秒)
|
200
|
+
:return:等待时间内达到期望应用状态(开启/关闭)返回True,否则返回False
|
201
|
+
'''
|
202
|
+
|
4
203
|
class Image:
|
5
204
|
@staticmethod
|
6
205
|
def Exists(imagePath: str, target: str | uia.Control, anchorsElement: uia.Control | None = None, rect: dict | None = None, accuracy: float = 0.9, searchDelay: int = 10000, continueOnError: bool = False, delayAfter: int = 0, delayBefore: int = 100, setForeground: bool = True, matchType: str = 'GrayMatch', backgroundPic: bool = False) -> bool:
|
@@ -224,3 +423,98 @@ class Image:
|
|
224
423
|
:param delayBefore:[可选参数]执行前延时(毫秒)。默认100
|
225
424
|
:return:None
|
226
425
|
'''
|
426
|
+
|
427
|
+
class Mail:
|
428
|
+
@staticmethod
|
429
|
+
def SendMail(user: str = '', pwd: str = '', sender: str = '', title: str = '', content: str = '', to: str | list = '', cc: str | list = None, attr: str | list = None, server: str = 'smtp.qq.com', port: int = 465, ssl: bool = True, timeout: int = 10, continueOnError: bool = False):
|
430
|
+
'''
|
431
|
+
发送邮件
|
432
|
+
|
433
|
+
Mail.SendMail(user=\'\', pwd=\'\', sender=\'\', title=\'\', content=\'\', to=\'\', cc=None, attr=None, server="smtp.qq.com", port=465, ssl=True, timeout=10, continueOnError=False)
|
434
|
+
|
435
|
+
:param user: [必选参数]邮箱登录帐号,比如普通QQ邮箱的登录帐号与邮箱地址相同
|
436
|
+
:param pwd: [必选参数]登录密码
|
437
|
+
:param sender: [必选参数]发件人邮箱地址
|
438
|
+
:param title: [必选参数]邮件的标题
|
439
|
+
:param content: [必选参数]邮件正文内容,支持HTML类型的正文内容
|
440
|
+
:param to: [必选参数]收件人邮箱地址,多个地址可用["xxx@qq.com","xxx@163.com"]列表的形式填写, 也可以是单个邮箱地址字符串
|
441
|
+
:param cc: [可选参数]抄送邮箱地址,多个地址可用["xxx@qq.com","xxx@163.com"]列表的形式填写, 也可以是单个邮箱地址字符串, None:不需要抄送,默认None
|
442
|
+
:param attr: [可选参数]邮件附件,多个附件可以用["附件一路径","附件二路径"]列表的形式填写,也可以是单个附件路径字符串, None:不需要附件,默认None
|
443
|
+
:param server: [可选参数]SMTP服务器地址,默认smtp.qq.com
|
444
|
+
:param port: [可选参数]SMTP服务器端口,常见为 25、465、587,默认465
|
445
|
+
:param ssl: [可选参数]是否使用SSL协议加密,True为使用,False为不使用,默认True
|
446
|
+
:param timeout: [可选参数]超时时间(秒),默认10
|
447
|
+
:param continueOnError: [可选参数]发生错误是否继续,True为继续,False为不继续。默认False
|
448
|
+
:return:None
|
449
|
+
'''
|
450
|
+
|
451
|
+
class HTTP:
|
452
|
+
@staticmethod
|
453
|
+
def SetCookies(cookies: dict = None) -> None:
|
454
|
+
'''
|
455
|
+
设置cookies
|
456
|
+
|
457
|
+
HTTP.SetCookies(None)
|
458
|
+
|
459
|
+
:param cookies:[可选参数]字典类型的cookies,例如:{"name":"value","name2":"value2"},默认None
|
460
|
+
:return:None
|
461
|
+
'''
|
462
|
+
@staticmethod
|
463
|
+
def SetHeaders(headers: dict = None) -> None:
|
464
|
+
'''
|
465
|
+
设置Headers
|
466
|
+
|
467
|
+
HTTP.SetHeaders(None)
|
468
|
+
|
469
|
+
:param headers:[可选参数]字典类型的请求头,例如:{"User-Agent": "Mozilla/5.0", "Accept-Language": "en-US"},默认None
|
470
|
+
:return:None
|
471
|
+
'''
|
472
|
+
@staticmethod
|
473
|
+
def Get(url: str, form: str | dict = None, delayTime: int = 60000) -> str:
|
474
|
+
'''
|
475
|
+
Get获取数据
|
476
|
+
|
477
|
+
text = HTTP.Get("", None, 60000)
|
478
|
+
|
479
|
+
:param url:[必选参数]Get页面的链接地址
|
480
|
+
:param form:[可选参数]Get时传递的表单数据,可以是字符串或字典,默认None
|
481
|
+
:param delayTime:[可选参数]超时时间,单位毫秒,默认60000毫秒
|
482
|
+
:return:获取的网络数据的结果
|
483
|
+
'''
|
484
|
+
@staticmethod
|
485
|
+
def Post(url: str, form: str | dict = None, delayTime: int = 60000) -> str:
|
486
|
+
'''
|
487
|
+
Post提交表单
|
488
|
+
|
489
|
+
text = HTTP.Post("", None, 60000)
|
490
|
+
|
491
|
+
:param url:[必选参数]Post页面的链接地址
|
492
|
+
:param form:[可选参数]Post时传递的表单数据,可以是字符串或字典,默认None
|
493
|
+
:param delayTime:[可选参数]超时时间,单位毫秒,默认60000毫秒
|
494
|
+
:return:向网页提交表单的结果
|
495
|
+
'''
|
496
|
+
@staticmethod
|
497
|
+
def PostJson(url: str, form: str | dict = None, delayTime: int = 60000) -> str:
|
498
|
+
'''
|
499
|
+
Post提交JSON表单
|
500
|
+
|
501
|
+
text = HTTP.PostJson("", None, 60000)
|
502
|
+
|
503
|
+
:param url:[必选参数]Post页面的链接地址
|
504
|
+
:param form:[可选参数]Post时传递的表单数据,可以是字符串或字典,默认None
|
505
|
+
:param delayTime:[可选参数]超时时间,单位毫秒,默认60000毫秒
|
506
|
+
:return:向网页提交JSON表单的结果
|
507
|
+
'''
|
508
|
+
@staticmethod
|
509
|
+
def GetFile(url: str, file: str, form: str | dict = None, delayTime: int = 60000) -> bool:
|
510
|
+
'''
|
511
|
+
Get下载文件
|
512
|
+
|
513
|
+
result = HTTP.GetFile("","",None,60000)
|
514
|
+
|
515
|
+
:param url:[必选参数]下载文件的链接地址
|
516
|
+
:param file:[必选参数]保存的文件路径
|
517
|
+
:param form:[可选参数]Get时传递的表单数据,可以是字符串或字典,默认None
|
518
|
+
:param delayTime:[可选参数]超时时间,单位毫秒,默认60000毫秒
|
519
|
+
:return:是否下载成功
|
520
|
+
'''
|