回复 1# huaisha1224
看到你的代码,让我情何以堪呢..你的进度与下载有什么关系呢?
#Include <FTPEx.au3>
Local $FileBuff,$ri = 0,$Percentage = 0
$server = '192.168.9.253'
$username = 'sam'
$pass = 'sam'
$NetPath = '/2.rar'
$Open = _FTP_Open('MyFTP Control')
$Conn = _FTP_Connect($Open, $server, $username, $pass)
$nSize=_FTP_FileGetSize($Conn,$NetPath)
$rFile = _FTP_FileOpen($Conn,$NetPath)
$lFIle = FileOpen(@ScriptDir & "\2.rar",2+8+16 )
ProgressOn ("下载进度","正在下载请稍候.....","0 %")
While 1
$FileBuff = _FTP_FileRead($rFile,1024 * 64) ;64K
If @error Then ExitLoop
$ri += BinaryLen($FileBuff)
FileWrite($lFile,$FileBuff)
$Percentage = Round($ri / $nSize * 100,2)
ProgressSet($Percentage ,$Percentage & " %")
Sleep(10)
WEnd
FileClose($lFile)
$Ftpc = _FTP_Close($Open)
ProgressOff() ;关闭进度条
MsgBox(0,"完成提示框","下载完成")
|