AU3下载功能可否多线程下载?
如题,不知有谁会的提供下源码参考! 同问顶起.搜索未果.. :face (35):别沉了,继续啊! 官网上有例子,搜索一下吧 官网上有例子,搜索一下吧menfan 发表于 2009-10-8 10:13 http://www.autoitx.com/images/common/back.gif
帮找下,我一进官网就卡的要死,等一会可以动了,刚动一下就又卡了! 1# 那片叶子 ; example code
If $CmdLine = 0 Then
Global $example
$example = "http://www.youtube.com"
$example = "http://www.yahoo.com"
$example = "http://www.msn.com"
_InetGet_MultiThread($example, 3)
EndIf
; file "InetGetMultiThread.au3" code starts here
; requires
#include <File.au3>
#include <INet.au3>
If $CmdLine >= 1 Then
If $CmdLine = "MultiThread" Then
$filename = StringTrimLeft($CmdLine, StringInStr($CmdLine, "/", 0, -1))
If StringRight($filename, 4) <> "html" And StringRight($filename, 4) <> ".htm" And StringRight($filename, 4) <> ".php" Then
$filename &= ".html"
EndIf
InetGet($CmdLine, $filename, 1, 0)
IniWrite(@ScriptDir & "\MultiThread.ini", "Section", "Thread" & $CmdLine, "0")
Exit
EndIf
EndIf
; function (array , number )
; array element is ignored
Func _InetGet_MultiThread(ByRef $inGMT_arr, $inGMT_threads)
Global $Thread_Control[$inGMT_threads+1]
Dim $inGMT_arr_UB = UBound($inGMT_arr)
Dim $inGMT_Progress = 0
If FileExists(@ScriptDir & "\MultiThread.ini") = 0 Then
$InGMT_i = 1
For $InGMT_i = 1 To $inGMT_threads
IniWrite(@ScriptDir & "\MultiThread.ini", "Section", "Thread" & $InGMT_i, "0")
Next
EndIf
While 1
$InGMT_i = 1
For $InGMT_i = 1 To $inGMT_threads
$Thread_Control[$InGMT_i] = IniRead(@ScriptDir & "\MultiThread.ini", "Section", "Thread" & $InGMT_i, "")
Next
If $inGMT_Progress < $inGMT_arr_UB -1 Then
$InGMT_i = 1
For $InGMT_i = 1 To $inGMT_threads
If $Thread_Control[$InGMT_i] = 0 Then
$inGMT_Progress += 1
ShellExecute(@ScriptName, "MultiThread" & " " & $InGMT_i & " " & $inGMT_arr[$inGMT_Progress], "", "Run")
IniWrite(@ScriptDir & "\MultiThread.ini", "Section", "Thread" & $InGMT_i, "1")
EndIf
If $inGMT_Progress = $inGMT_arr_UB -1 Then
ExitLoop
EndIf
Next
Else
$finished = 0
$InGMT_i = 1
For $InGMT_i = 1 To $inGMT_threads
$finished += $Thread_Control[$InGMT_i]
Next
If $finished = 0 Then
ExitLoop
EndIf
EndIf
WEnd
FileDelete(@ScriptDir & "\MultiThread.ini")
MsgBox(0, "", "multi pass!", 1)
Return 1
EndFunc参见总站:http://www.autoitscript.com/forum/index.php?showtopic=92660&st=0&p=665925&hl=thread%20download&fromsearch=1&#entry665925
同时下载多个文件,而非单文件多线程下载... 刚又搜索了一遍.没找到..英文水平也有限..期待有人.. 最新版本可以下载来一看便知~ 可以?怎么可以?adlibregister? :face (8): 别沉啊!
页:
[1]