找回密码
 加入
搜索
查看: 2138|回复: 3

[AU3基础] 如何判断处理这个弹出框

[复制链接]
发表于 2011-11-7 14:41:19 | 显示全部楼层 |阅读模式
下载文件已经存在时,弹出如下图小窗口。不存在时,不弹出。

请问:如何判断处理这种情况?

现在的代码片段如下:
Dim $path = "c:/downloadFile"
WinWaitActive("File Download")

Send("!s")

WinWaitActive("Save As")

ControlSetText("Save As","File &name:","Edit1",$path)

Send("!s")

/*
if(弹出了那个文件已经存在的小窗口){
点击小窗口中的yes
}
*/

求助:如何写这个if语句

图片:
发表于 2011-11-7 14:45:18 | 显示全部楼层
If FileExists("c:/downloadFile") = 1 Then
发表于 2011-11-7 15:20:49 | 显示全部楼层
FileExists
--------------------------------------------------------------------------------

检查指定文件或目录是否存在.


FileExists ( "路径" )




参数

路径 要检查的文件或目录的路径.



返回值

成功: 返回值为1.
失败: 返回值为0,说明指定的路径/文件并不存在.



注意/说明

如果指定路径参数为未插入磁盘的软驱则 FileExists 的返回值为0.




相关

FileGetAttrib, DriveStatus


示例/演示


If FileExists("C:\autoexec.bat") Then
    MsgBox(4096, "C:\autoexec.bat 文件", "C:\autoexec.bat 文件存在")
Else
    MsgBox(4096,"C:\autoexec.bat 文件", "C:\autoexec.bat 文件不存在")
EndIf

If FileExists("C:\") Then
    MsgBox(4096, "C:\ 目录 ", "C:\ 目录存在")
Else
    MsgBox(4096,"C:\ 目录" , "C:\ 目录不存在")
EndIf

If FileExists("D:") Then
    MsgBox(4096, "驱动器 D:", "驱动器D:存在")
Else
    MsgBox(4096,"驱动器 D:", "驱动器D:不存在")
EndIf
 楼主| 发表于 2011-11-7 16:30:18 | 显示全部楼层
非常感谢2楼3楼的帮助,完成了99% 还有一点小问题:

Dim $path = "c:\downloadFile"
WinWaitActive("File Download")
Sleep(2000)
Send("!s")
Sleep(2000)
WinWaitActive("Save As")
Sleep(2000)
ControlSetText("Save As","File &name:","Edit1",$path)
Sleep(2000)
Send("!s")
If FileExists("c:\downloadFile.xls") Then
Send("!y")
Else
Send("!s")
-----------------------------------------------------------------------------------
If FileExists("c:\downloadFile.xls")  如果这个文件的后缀名不确定,该怎么办?
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-20 21:44 , Processed in 0.111004 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表