python调用autoit组件自动使用plsqldev导出每日需要的业务报表

一,环境检查

操作系统:windows 2008 R2 64位版本

二,准备安装包

1.python 2.7 32位

2.pip 9.0.1 

三,安装环境

安装完python和pip之后

pip install -U pyautoit
python setup.py install

下载并安装autoit环境

四,调试环境

# -*- coding: utf-8 -*-


#此用例在Win2008中文版下测试通过,由于没有做本地化处理,在编写程序时,应该特别注意语言的匹配


import autoit
import time




autoit.run("C:\Program Files (x86)\PLSQL Developer\plsqldev.exe")
time.sleep(2)
autoit.send("queryuser",2)
time.sleep(2)
autoit.control_click("Oracle 登录","确定")
time.sleep(5)
autoit.send("!os")
time.sleep(2)
autoit.control_set_text("打开","[CLASS:Edit; INSTANCE:1]","sql.sql")
time.sleep(2)
autoit.send("!o")
time.sleep(2)
autoit.send("!se")
time.sleep(5)
autoit.send("!{END}")
time.sleep(5)
autoit.mouse_click("right",720,450,1)
time.sleep(2)
autoit.send("x")
time.sleep(2)
autoit.send("{ENTER}")
time.sleep(2)
autoit.win_activate("Microsoft Excel - tmp001.xls  [兼容模式]")
time.sleep(2)
autoit.send("!fa")
time.sleep(2)
autoit.send("!d")
time.sleep(2)
autoit.win_activate("另存为")
time.sleep(2)
autoit.send("{ASC 68}{ASC 58}{ASC 92}{ASC 114}{ASC 101}{ASC 112}{ASC 111}{ASC 114}{ASC 116}{ASC 115}{ASC 92}{ASC 122}{ASC 105}{ASC 106}{ASC 105}{ASC 110}{ASC 115}{ASC 117}{ASC 111}{ASC 92}{ASC 115}{ASC 101}{ASC 114}{ASC 118}{ASC 105}{ASC 99}{ASC 101}{ASC 70}{ASC 101}{ASC 101}")
time.sleep(2)
autoit.send("{ENTER}")
time.sleep(5)
autoit.control_set_text("另存为","[CLASS:ComboBox; INSTANCE:1]","temphahaha.xls")
time.sleep(5)
autoit.send("!s")
autoit.win_activate("确认另存为")
time.sleep(2)
autoit.send("!y")

注意:含有中文字符要在notepad++上调整为ansi格式,不然会有乱码
















评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值