首页 > 编程语言 > 详细

python3 驱动自动安装脚本

时间:2019-10-18 01:20:58      阅读:100      评论:0      收藏:0      [点我收藏+]
from pywinauto.application import Application
import os
import time
os.system(‘start C:/Users/Administrator/Desktop/APD_507_T82II.exe‘)
time.sleep(5)
#连接软件
app = Application(backend=‘win32‘)
app.connect(title_re=‘EPSON Advanced Printer Driver Ver.5‘,class_name=‘#32770‘)
time.sleep(1)
dw = app.window(title_re=‘EPSON Advanced Printer Driver Ver.5‘,class_name=‘#32770‘)
dw.set_focus()
dw[‘下一步(&N)‘].click()
time.sleep(1)
dw[‘同意(A)‘].click()
time.sleep(1)
dw[‘安装(I)‘].click()
while True:
if dw.window(title=‘下一步(&N) >‘,class_name=‘Button‘).exists():
break
dw[‘下一步(&N) >‘].click()
#app[‘EPSON Advanced Printer Driver Ver.5‘].Close()
#连接新窗口
bpp = Application(backend=‘win32‘)
print ("请稍后.....程序正在执行中")
bpp.connect(title_re=‘注册、更改和删除EPSON TM Printer‘,class_name=‘#32770‘,timeout=20)
dw = bpp.window(title_re=‘注册、更改和删除EPSON TM Printer‘,class_name=‘#32770‘)
dw.ComBox2.select(3)
dw.ComBox2.select(‘USB‘)
dw[‘设为默认打印机‘].click()
dw[‘保存设置 (S)‘].click()
dw = bpp.window(title=‘PrinterReg‘, class_name=‘#32770‘)
dw[‘否(N)‘].click()
dw = bpp.window(title_re=‘注册、更改和删除EPSON TM Printer‘,class_name=‘#32770‘)
dw[‘下一步‘].click()
print ("请稍后.....程序正在执行中")
dw = bpp.connect(title_re=‘EPSON Advanced Printer Driver Ver.5‘,class_name=‘#32770‘,timeout=20)
dw.window(title_re=‘EPSON Advanced Printer Driver Ver.5‘,class_name=‘#32770‘)
while True:
if dw.window(title_re=‘关闭(C)‘,class_name=‘Button‘).exists():
break
dw[‘关闭(C)‘].click()
print ("打印机驱动安装完毕")
-------------------------------
该程序未编写界面,直接打包成执行脚本。

python3 驱动自动安装脚本

原文:https://www.cnblogs.com/sheshidu/p/11695847.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!