当前位置:网站首页>使用autoIt 上传文件
使用autoIt 上传文件
2022-06-29 17:33:00 【bobob_】
1. 编写脚本
$fileName=$cmdline[1]
ControlFocus("打开","","Edit1")
ControlSetText("打开","","Edit1",$fileName)
ControlClick("打开","","Button1")
2.编译脚本为: uploadFile.exe
3.在java 代码中调用uploadFile.exe
/**
*
* @param fileName 全路径文件名 e.g :C:\\Users\\Administrator\\Downloads\\user_ex.csv
*/
public static void uploadFile(String fileName) {
try {
if(I2GUITestPage.isDebug()){
Runtime.getRuntime().exec("D:\\bat\\autoit\\uploadFile.exe "+fileName);
}else{
Runtime.getRuntime().exec("Z:\\resources\\uploadFile.exe "+fileName);
}
} catch (IOException e) {
e.printStackTrace();
}
}
小知识点:
在cmd 中执行AutoIt 自动化脚本时,可以向脚本传递参数。
AutoIt脚本在执行的时候,会自动初始化一个特殊的数组 $CmdLine,其中$CmdLine[0] 代表参数的数量,$CmdLine[1] 代表第一个参数 ,$CmdLine[2] 代表 第二个参数。
边栏推荐
- 2022 software evaluator examination outline
- 自定義HandlerInterceptor攔截器實現用戶鑒權
- Error:Connection refused: connect
- Collaborative development of epidemic home outsourcing project 𞓜 community essay solicitation
- R语言使用epiDisplay包的kap函数(kap.2.raters函数)计算Kappa统计量的值(总一致性、期望一致性)、对两个评分对象的结果进行一致性分析、评分的类别为多个类别
- High landing pressure of "authorization and consent"? Privacy computing provides a possible compliance "technical solution"
- Sectigo ov pan domain name certificate is 1590 yuan a year easy to use
- Pancakeswap Technology: development principle of gripper robot system
- 关于harbor私有仓库忘记登录密码
- Subgraphs in slam
猜你喜欢
随机推荐
Help MySQL data analysis with databend
Online sql to CSV tool
SpingMVC请求和响应
R语言将距离矩阵输入给hclust函数进行层次聚类分析,method参数指定两个组合数据点间的距离计算方式、plot函数可视化层次聚类的树状图(dendrogram)
Multi mode concurrent implementation of tortoise and rabbit race in go language
controller、service、dao之间的关系
【R语言数据科学】:文本挖掘(以特朗普推文数据为例)
The soft youth under the blessing of devcloud makes education "smart" in the cloud
Pancakeswap Technology: development principle of gripper robot system
How to solve MySQL 1045 error in Linux
How to solve the 2003 error of MySQL in Linux
Redis bloom filter and cuckoo filter
What are the usage scenarios for locks in MySQL
The R language uses the KAP function (kap.2.raters function) of epidisplay package to calculate the value of kappa statistics (total consistency, expected consistency), analyze the consistency of the
Browser large screen capture
What role does the supply chain management system play in the supply chain scenario?
External automatic (PLC start robot)
R语言使用epiDisplay包的kap函数(kap.2.raters函数)计算Kappa统计量的值(总一致性、期望一致性)、对两个评分对象的结果进行一致性分析、评分的类别为多个类别
Online text digit recognition list summation tool
Redis principle - sorted set (Zset)









