基于AutoIt3的打印机安装
#Region ;**** 编译指令由 AutoIt3Wrapper 选项编译窗口创建 ****
#AutoIt3Wrapper_Icon=favicon.ico
#AutoIt3Wrapper_Compile_Both=y
#EndRegion ;**** 编译指令由 AutoIt3Wrapper 选项编译窗口创建 ****
#cs ---------------------------------------------------------------------------- Version: 1.0
Author: MaJunyi #ce ----------------------------------------------------------------------------
#include <StringConstants.au3> ; for 正则表达式
#include <GUIConstantsEx.au3> ; for GUI
#include <WinAPIShellEx.au3>; for winShell
#include <InetConstants.au3>; for download
; CPL文件,又叫控制面板项(Control Panel Item),多保存于系统安装目录的system32文件夹下,它们分别对应着控制面板中的项目 ; 优化:
; . 可以添加一号楼绝大部分打印机
; . 可添加二号楼3..5楼打印机
; . 可进入---控制面板\所有控制面板项\设备和打印机(control printers)
; 不足:
; . 暂未添加用户名至网络打印机
; . 打印楼层单一 $headlabel = "打印机添加和安装"
GUICreate($headlabel, , )
$okbutton = GUICtrlCreateButton("确认安装", , , , )
$localPrintBtn = GUICtrlCreateButton("已安装的打印机", , , , )
$printDriverBtn = GUICtrlCreateButton("打印机驱动", , , , ) $guiTop = GUICtrlCreateLabel("请选择您的位置:", , $guiTop)
$guiTop+=
Local $idRadio1 = GUICtrlCreateRadio("一号楼", , $guiTop)
$guiTop1 = $guiTop
$guiTop+=
Local $idRadio231 = GUICtrlCreateRadio("二号楼-3楼1", , $guiTop)
$guiTop231 = $guiTop
$guiTop+=
Local $idRadio232 = GUICtrlCreateRadio("二号楼-3楼2", , $guiTop)
$guiTop232 = $guiTop
$guiTop+=
Local $idRadio241 = GUICtrlCreateRadio("二号楼-4楼1", , $guiTop)
$guiTop241 = $guiTop
$guiTop+=
Local $idRadio242 = GUICtrlCreateRadio("二号楼-4楼2", , $guiTop)
$guiTop242 = $guiTop
$guiTop+=
Local $idRadio25 = GUICtrlCreateRadio("二号楼-5楼", , $guiTop)
$guiTop25 = $guiTop ; 检测是否云桌面
isCloudOrNot()
GUISetState(@SW_SHOW)
Sleep()
; 下载驱动
$printDriverIp = "\\xxx.xxx.xxx.xxx"
; GUICtrlCreateLabel("连接及下载打印机驱动,从" & $printDriverIp, , )
; Sleep()
; $openNetPrint = _WinAPI_ShellExecute ($printDriverIp)
; GUICtrlCreateLabel("尝试连接打印机(会显示打印机任务,需去打印机刷卡才会打印)", , )
; Sleep() ; GUICtrlCreateLabel("打开 " & $ctrlPrintShow, , ) ; net use \\xxx.xxx.xxx.xxx\eFollow_Printer /user:HEM100 ; Script Start - Add your code below here
; 检测是否云
Func isCloudOrNot()
Local $string0 = StringRegExp(@IPAddress1, '(172.xx.)(\d+.\d+)', $STR_REGEXPARRAYMATCH)
If Not @error Then
$isYun =
MsgBox(,'', '您是尊贵的云用户,不能添加打印机')
Else
If @error== Then
; Return "您不是云用户"
Return "正在为您添加打印机"
Else
Return "请联系开发人员,错误代码:" & @error
; : 正则表达式错误, 数组无效.
EndIf
EndIf
EndFunc Global $chooseRadio
Global $driverIp
Global $driverIpFile
$LianJieTipsLeft = While
$msg = GUIGetMsg()
Select
Case $msg = $idRadio1 And BitAND(GUICtrlRead($idRadio1), $GUI_CHECKED) = $GUI_CHECKED
$chooseRadio =
; MsgBox($MB_SYSTEMMODAL, 'Info', $chooseRadio)
GUICtrlCreateLabel("驱动服务器" & canConnectOrNot('xxx.xxx.xxx.xxx'), $LianJieTipsLeft, $guiTop1+)
Case $msg = $idRadio231 And BitAND(GUICtrlRead($idRadio231), $GUI_CHECKED) = $GUI_CHECKED
$chooseRadio = ;ok
$driverIpFile = "\UNIV_driver\Setup.exe"
$driverIp = "\\172.16.11.234"
GUICtrlCreateLabel("驱动服务器" & canConnectOrNot('xxx.xxx.xxx.xxx'), $LianJieTipsLeft, $guiTop231+)
Case $msg = $idRadio232 And BitAND(GUICtrlRead($idRadio232), $GUI_CHECKED) = $GUI_CHECKED
$chooseRadio = ;ok
$driverIpFile = "\UNIV_driver\essetup.exe"
$driverIp = "\\172.16.11.220"
GUICtrlCreateLabel("驱动服务器" & canConnectOrNot('xxx.xxx.xxx.xxx'), $LianJieTipsLeft, $guiTop232+)
Case $msg = $idRadio241 And BitAND(GUICtrlRead($idRadio241), $GUI_CHECKED) = $GUI_CHECKED
$chooseRadio = ;ok
$driverIpFile = "\UNIV_driver\Setup.exe"
$driverIp = "\\172.16.242.245"
GUICtrlCreateLabel("驱动服务器" & canConnectOrNot('xxx.xxx.xxx.xxx'), $LianJieTipsLeft, $guiTop241+)
Case $msg = $idRadio242 And BitAND(GUICtrlRead($idRadio242), $GUI_CHECKED) = $GUI_CHECKED
$chooseRadio = ;ok
$driverIpFile = "\UNIV_driver\essetup.exe"
$driverIp = "\\172.16.11.228"
GUICtrlCreateLabel("驱动服务器" & canConnectOrNot('xxx.xxx.xxx.xxx'), $LianJieTipsLeft, $guiTop242+)
Case $msg = $idRadio25 And BitAND(GUICtrlRead($idRadio25), $GUI_CHECKED) = $GUI_CHECKED
$chooseRadio = ;ok
$driverIpFile = "\UNIV_driver\Setup.exe"
$driverIp = "\\172.16.241.172"
GUICtrlCreateLabel("驱动服务器" & canConnectOrNot('xxx.xxx.xxx.xxx'), $LianJieTipsLeft, $guiTop25+)
Case $msg = $okbutton
If $chooseRadio == Then
MsgBox(,"","尝试连接打印机(会显示打印机任务,需去打印机刷卡才会打印)")
$openNetPrintFile = _WinAPI_ShellExecute ("\\xxx.xxx.xxx.xxx\eFollow_Printer")
ElseIf $chooseRadio > Then
$mLink = $driverIp & $driverIpFile
$openNetPrintFile = _WinAPI_ShellExecute ($mLink)
; downloadFile('printDriver.exe', "file://xxx.xxx.xxx.xxx/UNIV_driver/Setup.exe")
Else
MsgBox(,"","请选择您的位置")
EndIf
; ExitLoop
Case $msg = $localPrintBtn
; $ctrlPrintShow = "控制面板\硬件和声音\设备和打印机"
; $openPrintDir = _WinAPI_ShellExecute("::{2227A280-3AEA-1069-A2DE-08002B30309D}")
$openPrintDir = Run(@SystemDir & "\control.exe printers")
Case $msg = $printDriverBtn
$openNetPrintFile = _WinAPI_ShellExecute ("\\xxx.xxx.xxx.xxx")
Case $msg = $GUI_EVENT_CLOSE
; 关闭对话框事件
ExitLoop
EndSelect
WEnd ; 检测是否能连接上指定IP
Func canConnectOrNot($testIP)
; Ping网站,超时时间为 毫秒.
Local $iPing = Ping($testIP, )
If $iPing Then
Return "连接成功"
Else
;当函数执行失败时(返回 )@error 包含数值的具体信息:
If @error == Then
Return "离线"
ElseIf @error == Then
Return "无法到达"
ElseIf @error == Then
Return "目标错误"
ElseIf @error == Then
Return "其他错误-连接超时"
Else
Return "连接超时"
EndIf
EndIf
EndFunc Func downloadFile($mFile, $link)
ProgressOn("下载新版本:"&$mFile, "正在更新版本,请稍候...", "0%")
Local $i =
Do
Sleep()
;$i = $i+
$i = Round(FileGetSize($mFile)//)
; Update the progress value of the progress bar window.
ProgressSet($i, $i & "%")
Until InetGetInfo($link, $INET_DOWNLOADCOMPLETE)
; Set the "subtext" and "maintext" of the progress bar window.
ProgressSet(, "更新完成", "Complete")
Sleep()
; Close the progress window.
ProgressOff()
EndFunc
基于AutoIt3的打印机安装的更多相关文章
- 【申嵌视频】基于VMWare虚拟机下安装ubuntu操作系统的详细步骤
[申嵌视频]基于VMWare虚拟机下安装ubuntu操作系统 适合搭建mini2440, Tiny6410, smart210,Tiny4412, NanoPC-T2, NanoPC-T3, Nano ...
- 树莓派进阶之路 (035) - 基于linux的zsh安装脚本
基于linux的zsh安装脚本: Ubuntu版本: #!/bin/sh cd #安装zsh sudo apt-get install zsh #查看zsh cat /etc/shells #更改zs ...
- 基于yum的方式安装Cloudera Manager Agent(使用Mysql 8.0版本)
基于yum的方式安装Cloudera Manager Agent(使用Mysql 8.0版本) 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.选择CDH版本 1>.确认 ...
- 基于yum的方式安装Cloudera Manager Server(使用Mysql 8.0版本)
基于yum的方式安装Cloudera Manager Server(使用Mysql 8.0版本) 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.安装和配置元数据库 1>. ...
- Mysql安装 ----> 基于源码包安装
1)基于源码包安装MySQL [root@localhost ~]# rpm -q mysql mysql-server mariadb mairadb-server //检查有没 ...
- ActiveMQ此例简单介绍基于docker的activemq安装与集群搭建
ActiveMQ拓展连接 此例简单介绍基于Docker的activemq安装与集群搭建 一 :安装 1.获取activemq镜像 docker pull webcenter/activemq 2.启动 ...
- windows平台下基于VisualStudio的Clang安装和配置
LLVM 是一个开源的编译器架构,它已经被成功应用到多个应用领域.Clang是 LLVM 的一个编译器前端,它目前支持 C, C++, Objective-C 以及 Objective-C++ 等编程 ...
- 基于kickstart定制自动化安装的linux镜像系统
使用软件和平台 1.基于平台: Vmware workstation 8.0 2.基于系统镜像: rhel-server-5.8-i386 ...
- 基于vue,打印机打印暂且处理
基于vue单页面应用.暂且没找到合适的方案,什么vue-print .jquery.print.js.jqprint.js..canvas生成图片啊 大多不能保证页面样式保持原样. 所以,选择了最土 ...
随机推荐
- 移动端以及 PC浏览器页面分享到朋友圈等的功能实现
我们经常可以在一些 app上看到分享到朋友圈.微信好友.qq好友等功能,例如 饿了么.美团等 app,下单之后就会弹出给好友发红包的 modal窗,这在 app上很常见,app的权限可以很大,甚至连启 ...
- Spring_Bean的作用域---和使用外部属性文件
<!-- 使用 bean的scope属性来配置bean的作用域 singleton:默认值.容器初始时创建bean实例,在整个容器的生命周期内只创建这一个bean单例 prototype:原型的 ...
- iOS 检测耳机插入/拔出
http://www.verydemo.com/demo_c134_i28481.html 开发过程中录音和播放这块碰到了一些问题,麻烦的主要有三个: 检测是否有声音输入设备 当有多个声音输出设备时, ...
- #define 和常量 const 的区别
const 后的常量,程序对其中只能读不能修改. #include <iostream> using namespace std; int main() { const double pi ...
- gpu命令cuda命令
# device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")os.envi ...
- Java面向对象----封装概念
封装 信息隐藏,隐藏对象的细节 访问修饰符 public private protected 默认 属性封装的实现 方法封装的目的(隐藏方法实现细节) package com.tanlei.newer ...
- 查看JAVA占用CPU高的线程日志
# . 查看主进程占用cpu高 top # java # . 按照线程占用cpu由高到低进行排查: -o THREAD,tid, # USER %CPU PRI SCNT WCHAN USER SYS ...
- C++与JAVA代码实现CRC-16/MODBUS算法,且与 http://www.ip33.com/crc.html 进行结果验证
CRC-16/MODBUS的多项式为:x16+x15+x2+1(8005),宽度为16.运算时,首先将一个16位的寄存器预置为11111111 11111111,然后连续把数据帧中的每个字节中的8位与 ...
- 云原生生态周报 Vol. 3 | Java 8 ❤️ Docker
摘要: Docker Hub遭入侵,19万账号被泄露:Java 8 终于开始提供良好的容器支持:Snyk 年度安全报告出炉,容器安全问题形势空前严峻. 业界要闻 Docker Hub遭入侵,19万账号 ...
- @NOIP2018 - D1T1@ 铺设道路
目录 @题目描述@ @考场上的思路@ @比较正常的题解@ @题目描述@ 春春是一名道路工程师,负责铺设一条长度为 n 的道路. 铺设道路的主要工作是填平下陷的地表.整段道路可以看作是 n 块首尾相连的 ...