Jump to content

DownloaderMultiFiles


wolf9228
 Share

Recommended Posts

DownloaderMultiFiles.au3

#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

Dim $Array , $complete = False
DownloaderMultiFiles($Array,"http://www.win-rar.com/downloads/wrar393.exe",@ScriptDir & "\Dir1")
DownloaderMultiFiles($Array,"http://www.win-rar.com/downloads/wrar393bg.exe",@ScriptDir & "\Dir1")
DownloaderMultiFiles($Array,"http://www.win-rar.com/downloads/wrar393.exe",@ScriptDir & "\Dir2")
;only 2 file in one time download in WinRar Site
DownloaderMultiFiles($Array,"http://www.autoitscript.com/cgi-bin/getfile.pl?../autoit3/scite/" & _
"download/SciTE4AutoIt3.exe",@ScriptDir & "\Dir2")

While 1
if $complete = False Then
$complete = ProgressLoop($Array,$complete)
Else
MsgBox(0,"","download is complete")
Exit
EndIf
WEnd

Func ProgressLoop($Array,$complete = False)
if $complete = False Then
Dim $TempArray[1][7]
$complete = True
For $i = 0 To UBound($Array) - 1
Sleep(250)
$read = InetGetInfo($Array[$i][5],0)
$Size = InetGetInfo($Array[$i][5],1)
$Array[$i][6] += $read
$CompBool = InetGetInfo($Array[$i][5],2)
$error = @error
GUICtrlSetData($Array[$i][3],(100 / $Size) * $read)
GUICtrlSetData($Array[$i][4],"( " & StringLeft(int($read / 1024) / 1000 ,8) _
& " OF " & StringLeft(int($Size /1024) / 1000 ,8) & " ) MB")
if $CompBool = False And Not $error Then
$complete = False
$TempArray[UBound($TempArray) -1][0] = $Array[$i][0]
$TempArray[UBound($TempArray) -1][1] = $Array[$i][1]
$TempArray[UBound($TempArray) -1][2] = $Array[$i][2]
$TempArray[UBound($TempArray) -1][3] = $Array[$i][3]
$TempArray[UBound($TempArray) -1][4] = $Array[$i][4]
$TempArray[UBound($TempArray) -1][5] = $Array[$i][5]
$TempArray[UBound($TempArray) -1][6] = $Array[$i][6]
ReDim $TempArray[UBound($TempArray) +1][7]
Else
InetClose($Array[$i][5])
EndIf
Next
if $complete Then GUIDelete($Array[0][2])
if UBound($TempArray) > 1 Then
ReDim $TempArray[UBound($TempArray) - 1][7]
Else
$TempArray = 0
EndIf
$Array = $TempArray
Return $complete
EndIf
EndFunc

Func DownloaderMultiFiles(ByRef $Array,$link,$OutDir)
if Not IsArray($Array) Then
Dim $Array[1][7]
$Array[0][2] = GUICreate("Downloader Progress", 590, 140, 100, 200, _
BitOR($WS_MINIMIZEBOX,$WS_SYSMENU,$WS_CAPTION,$WS_POPUP,$WS_POPUPWINDOW _
,$WS_GROUP,$WS_BORDER,$WS_CLIPSIBLINGS))
GUISetState(@SW_SHOW)
Else
ReDim $Array[UBound($Array) + 1][7]
EndIf
if StringRight($OutDir,1) == "\" Then $OutDir = StringTrimRight($OutDir,1)
if Not FileExists($OutDir) Then DirCreate($OutDir)
$FileName = StringSplit($link,"/")
$FileName = $FileName[$FileName[0]]
$OutDir &= "\" & $FileName
$Array[UBound($Array) - 1][0] = $link
$Array[UBound($Array) - 1][1] = $OutDir
$Array[UBound($Array) - 1][3] = GUICtrlCreateProgress(190, 10 + ((UBound($Array) - 1) * 30), 200, 20)
GUICtrlCreateLabel($FileName, 10, 10 + ((UBound($Array) - 1) * 30), 170, 20, BitOR($SS_CENTER,$WS_BORDER))
GUICtrlSetFont(-1, 10, 600, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0xFFFFFF)
$Array[UBound($Array) - 1][4] = GUICtrlCreateLabel("", 400, 10 + ((UBound($Array) - 1) * 30), 170, 20,BitOR($SS_CENTER,$WS_BORDER))
GUICtrlSetFont(-1, 10, 600, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0xFFFFFF)
$Array[UBound($Array) - 1][5]  = InetGet($Array[UBound($Array) - 1][0],$Array[UBound($Array) - 1][1], 1, 1)
Sleep(1500)
EndFunc

New Code

Gui VSCROLL

#include <GUIScrollBars.au3>

#include <ScrollBarConstants.au3>

GUIRegisterMsg($WM_SIZE, "WM_SIZE")

GUIRegisterMsg($WM_VSCROLL, "WM_VSCROLL")

#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>

Dim $Array , $complete = False

$file = FileOpen("links.txt", 0)
$SpArray = StringSplit(FileRead($file),@LF)
For $i = 1 To $SpArray[0]
$Line = StringStripWS($SpArray[$i],3)
if $Line <> "" Then _
DownloaderMultiFiles($Array,$Line,@ScriptDir & "\Dir")
Next
FileClose($file)



;DownloaderMultiFiles($Array,"http://www.win-rar.com/downloads/wrar393.exe",@ScriptDir & "\Dir1")
;DownloaderMultiFiles($Array,"http://www.win-rar.com/downloads/wrar393bg.exe",@ScriptDir & "\Dir1")
;DownloaderMultiFiles($Array,"http://www.win-rar.com/downloads/wrar393.exe",@ScriptDir & "\Dir2")
;only 2 file in one time download in WinRar Site
;DownloaderMultiFiles($Array,"http://www.autoitscript.com/cgi-bin/getfile.pl?../autoit3/scite/" & _
;"download/SciTE4AutoIt3.exe",@ScriptDir & "\Dir2")

While 1
if $complete = False Then
$complete = ProgressLoop($Array,$complete)
Else
MsgBox(0,"","download is complete")
Exit
EndIf
WEnd

Func ProgressLoop($Array,$complete = False)
if $complete = False Then
Dim $TempArray[1][7]
$complete = True
For $i = 0 To UBound($Array) - 1
Sleep(250)
$read = InetGetInfo($Array[$i][5],0)
$Size = InetGetInfo($Array[$i][5],1)
$Array[$i][6] += $read
$CompBool = InetGetInfo($Array[$i][5],2)
$error = @error
GUICtrlSetData($Array[$i][3],(100 / $Size) * $read)
GUICtrlSetData($Array[$i][4],"( " & StringLeft(int($read / 1024) / 1000 ,8) _
& " OF " & StringLeft(int($Size /1024) / 1000 ,8) & " ) MB")
if $CompBool = False And Not $error Then
$complete = False
$TempArray[UBound($TempArray) -1][0] = $Array[$i][0]
$TempArray[UBound($TempArray) -1][1] = $Array[$i][1]
$TempArray[UBound($TempArray) -1][2] = $Array[$i][2]
$TempArray[UBound($TempArray) -1][3] = $Array[$i][3]
$TempArray[UBound($TempArray) -1][4] = $Array[$i][4]
$TempArray[UBound($TempArray) -1][5] = $Array[$i][5]
$TempArray[UBound($TempArray) -1][6] = $Array[$i][6]
ReDim $TempArray[UBound($TempArray) +1][7]
Else
InetClose($Array[$i][5])
EndIf
Next
if $complete Then GUIDelete($Array[0][2])
if UBound($TempArray) > 1 Then
ReDim $TempArray[UBound($TempArray) - 1][7]
Else
$TempArray = 0
EndIf
$Array = $TempArray
Return $complete
EndIf
EndFunc

Func DownloaderMultiFiles(ByRef $Array,$link,$OutDir)
if Not IsArray($Array) Then
Dim $Array[1][7]
$Array[0][2] = GUICreate("Downloader Progress", 590, 130, 100, 200, _
BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_SIZEBOX))
GUIRegisterMsg($WM_SIZE, "WM_SIZE")
GUIRegisterMsg($WM_VSCROLL, "WM_VSCROLL")
_GUIScrollBars_Init($Array[0][2])
GUISetState(@SW_SHOW)
Else
ReDim $Array[UBound($Array) + 1][7]
EndIf
if StringRight($OutDir,1) == "\" Then $OutDir = StringTrimRight($OutDir,1)
if Not FileExists($OutDir) Then DirCreate($OutDir)
$FileName = StringSplit($link,"/")
$FileName = $FileName[$FileName[0]]
$OutDir &= "\" & $FileName
$Array[UBound($Array) - 1][0] = $link
$Array[UBound($Array) - 1][1] = $OutDir
$Array[UBound($Array) - 1][3] = GUICtrlCreateProgress(190, 10 + ((UBound($Array) - 1) * 30), 200, 20)
GUICtrlCreateLabel($FileName, 10, 10 + ((UBound($Array) - 1) * 30), 170, 20, BitOR($SS_CENTER,$WS_BORDER))
GUICtrlSetFont(-1, 10, 600, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0xFFFFFF)
$Array[UBound($Array) - 1][4] = GUICtrlCreateLabel("", 400, 10 + ((UBound($Array) - 1) * 30), 170, 20,BitOR($SS_CENTER,$WS_BORDER))
GUICtrlSetFont(-1, 10, 600, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0xFFFFFF)
$Array[UBound($Array) - 1][5]  = InetGet($Array[UBound($Array) - 1][0],$Array[UBound($Array) - 1][1], 1, 1)
Sleep(1500)
EndFunc



Func WM_SIZE($hWnd, $Msg, $wParam, $lParam)
    #forceref $Msg, $wParam
    Local $index = -1, $yChar, $xChar, $xClientMax, $xClient, $yClient, $ivMax
    For $x = 0 To UBound($aSB_WindowInfo) - 1
        If $aSB_WindowInfo[$x][0] = $hWnd Then
            $index = $x
            $xClientMax = $aSB_WindowInfo[$index][1]
            $xChar = $aSB_WindowInfo[$index][2]
            $yChar = $aSB_WindowInfo[$index][3]
            $ivMax = $aSB_WindowInfo[$index][7]
            ExitLoop
        EndIf
    Next
    If $index = -1 Then Return 0

    Local $tSCROLLINFO = DllStructCreate($tagSCROLLINFO)

    ; Retrieve the dimensions of the client area.
    $xClient = BitAND($lParam, 0x0000FFFF)
    $yClient = BitShift($lParam, 16)
    $aSB_WindowInfo[$index][4] = $xClient
    $aSB_WindowInfo[$index][5] = $yClient

    ; Set the vertical scrolling range and page size
    DllStructSetData($tSCROLLINFO, "fMask", BitOR($SIF_RANGE, $SIF_PAGE))
    DllStructSetData($tSCROLLINFO, "nMin", 0)
    DllStructSetData($tSCROLLINFO, "nMax", $ivMax)
    DllStructSetData($tSCROLLINFO, "nPage", $yClient / $yChar)
    _GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)

    ; Set the horizontal scrolling range and page size
    DllStructSetData($tSCROLLINFO, "fMask", BitOR($SIF_RANGE, $SIF_PAGE))
    DllStructSetData($tSCROLLINFO, "nMin", 0)
    DllStructSetData($tSCROLLINFO, "nMax", 2 + $xClientMax / $xChar)
    DllStructSetData($tSCROLLINFO, "nPage", $xClient / $xChar)
    _GUIScrollBars_SetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)

    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_SIZE

Func WM_VSCROLL($hWnd, $Msg, $wParam, $lParam)
    #forceref $Msg, $wParam, $lParam
    Local $nScrollCode = BitAND($wParam, 0x0000FFFF)
    Local $index = -1, $yChar, $yPos
    Local $Min, $Max, $Page, $Pos, $TrackPos

    For $x = 0 To UBound($aSB_WindowInfo) - 1
        If $aSB_WindowInfo[$x][0] = $hWnd Then
            $index = $x
            $yChar = $aSB_WindowInfo[$index][3]
            ExitLoop
        EndIf
    Next
    If $index = -1 Then Return 0


    ; Get all the vertial scroll bar information
    Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_VERT)
    $Min = DllStructGetData($tSCROLLINFO, "nMin")
    $Max = DllStructGetData($tSCROLLINFO, "nMax")
    $Page = DllStructGetData($tSCROLLINFO, "nPage")
    ; Save the position for comparison later on
    $yPos = DllStructGetData($tSCROLLINFO, "nPos")
    $Pos = $yPos
    $TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos")

    Switch $nScrollCode
        Case $SB_TOP ; user clicked the HOME keyboard key
            DllStructSetData($tSCROLLINFO, "nPos", $Min)

        Case $SB_BOTTOM ; user clicked the END keyboard key
            DllStructSetData($tSCROLLINFO, "nPos", $Max)

        Case $SB_LINEUP ; user clicked the top arrow
            DllStructSetData($tSCROLLINFO, "nPos", $Pos - 1)

        Case $SB_LINEDOWN ; user clicked the bottom arrow
            DllStructSetData($tSCROLLINFO, "nPos", $Pos + 1)

        Case $SB_PAGEUP ; user clicked the scroll bar shaft above the scroll box
            DllStructSetData($tSCROLLINFO, "nPos", $Pos - $Page)

        Case $SB_PAGEDOWN ; user clicked the scroll bar shaft below the scroll box
            DllStructSetData($tSCROLLINFO, "nPos", $Pos + $Page)

        Case $SB_THUMBTRACK ; user dragged the scroll box
            DllStructSetData($tSCROLLINFO, "nPos", $TrackPos)
    EndSwitch

;~    // Set the position and then retrieve it.  Due to adjustments
;~    //   by Windows it may not be the same as the value set.

    DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS)
    _GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)
    _GUIScrollBars_GetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)
    ;// If the position has changed, scroll the window and update it
    $Pos = DllStructGetData($tSCROLLINFO, "nPos")

    If ($Pos <> $yPos) Then
        _GUIScrollBars_ScrollWindow($hWnd, 0, $yChar * ($yPos - $Pos))
        $yPos = $Pos
    EndIf

    Return $GUI_RUNDEFMSG

EndFunc   ;==>WM_VSCROLL
Edited by wolf9228

صرح السماء كان هنا

 

Link to comment
Share on other sites

this is to download them from a txt file:

#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

$file = FileOpen("links.txt", 0)
If $file = -1 Then
MsgBox(0, "Error", "Unable to open file.")
Exit
EndIf

$1 = FileReadLine($file, 1)
$2 = FileReadLine($file, 2)
$3 = FileReadLine($file, 3)
$4 = FileReadLine($file, 4)
$5 = FileReadLine($file, 5)
$6 = FileReadLine($file, 6)
$7 = FileReadLine($file, 7)
$8 = FileReadLine($file, 8)
$9 = FileReadLine($file, 9)
$10 = FileReadLine($file, 10)
$11 = FileReadLine($file, 11)
$12 = FileReadLine($file, 12)
$13 = FileReadLine($file, 13)
$14 = FileReadLine($file, 14)
$15 = FileReadLine($file, 15)
$16 = FileReadLine($file, 16)
$17 = FileReadLine($file, 17)
$18 = FileReadLine($file, 18)
$19 = FileReadLine($file, 19)
$20 = FileReadLine($file, 20)



Dim $Array , $complete = False
DownloadserMultiFiles($Array, $1, @ScriptDir & "\Downloads")
DownloadserMultiFiles($Array, $2, @ScriptDir & "\Downloads")
DownloadserMultiFiles($Array, $3, @ScriptDir & "\Downloads")
DownloadserMultiFiles($Array, $4, @ScriptDir & "\Downloads")
DownloadserMultiFiles($Array, $5, @ScriptDir & "\Downloads")
DownloadserMultiFiles($Array, $6, @ScriptDir & "\Downloads")
DownloadserMultiFiles($Array, $7, @ScriptDir & "\Downloads")
DownloadserMultiFiles($Array, $8, @ScriptDir & "\Downloads")
DownloadserMultiFiles($Array, $9, @ScriptDir & "\Downloads")
DownloadserMultiFiles($Array, $10, @ScriptDir & "\Downloads")
DownloadserMultiFiles($Array, $11, @ScriptDir & "\Downloads")
DownloadserMultiFiles($Array, $12, @ScriptDir & "\Downloads")
DownloadserMultiFiles($Array, $13, @ScriptDir & "\Downloads")
DownloadserMultiFiles($Array, $14, @ScriptDir & "\Downloads")
DownloadserMultiFiles($Array, $15, @ScriptDir & "\Downloads")
DownloadserMultiFiles($Array, $16, @ScriptDir & "\Downloads")
DownloadserMultiFiles($Array, $17, @ScriptDir & "\Downloads")
DownloadserMultiFiles($Array, $18, @ScriptDir & "\Downloads")
DownloadserMultiFiles($Array, $19, @ScriptDir & "\Downloads")
DownloadserMultiFiles($Array, $20, @ScriptDir & "\Downloads")

While 1
if $complete = False Then
$complete = ProgressLoop($Array,$complete)
Else
MsgBox(0,"","Downloads is complete")
Exit
EndIf
WEnd

Func ProgressLoop($Array,$complete = False)
if $complete = False Then
Dim $TempArray[1][7]
$complete = True
For $i = 0 To UBound($Array) - 1
Sleep(250)
$read = InetGetInfo($Array[$i][5],0)
$Size = InetGetInfo($Array[$i][5],1)
$Array[$i][6] += $read
$CompBool = InetGetInfo($Array[$i][5],2)
$error = @error
GUICtrlSetData($Array[$i][3],(100 / $Size) * $read)
GUICtrlSetData($Array[$i][4],"( " & StringLeft(int($read / 1024) / 1000 ,8) _
& " OF " & StringLeft(int($Size /1024) / 1000 ,8) & " ) MB")
if $CompBool = False And Not $error Then
$complete = False
$TempArray[UBound($TempArray) -1][0] = $Array[$i][0]
$TempArray[UBound($TempArray) -1][1] = $Array[$i][1]
$TempArray[UBound($TempArray) -1][2] = $Array[$i][2]
$TempArray[UBound($TempArray) -1][3] = $Array[$i][3]
$TempArray[UBound($TempArray) -1][4] = $Array[$i][4]
$TempArray[UBound($TempArray) -1][5] = $Array[$i][5]
$TempArray[UBound($TempArray) -1][6] = $Array[$i][6]
ReDim $TempArray[UBound($TempArray) +1][7]
Else
InetClose($Array[$i][5])
EndIf
Next
if $complete Then GUIDelete($Array[0][2])
if UBound($TempArray) > 1 Then
ReDim $TempArray[UBound($TempArray) - 1][7]
Else
$TempArray = 0
EndIf
$Array = $TempArray
Return $complete
EndIf
EndFunc

Func DownloadserMultiFiles(ByRef $Array,$link,$OutDir)
if Not IsArray($Array) Then
Dim $Array[1][7]
$Array[0][2] = GUICreate("QDownloader", 590, 140, 100, 200, _
BitOR($WS_MINIMIZEBOX,$WS_SYSMENU,$WS_CAPTION,$WS_POPUP,$WS_POPUPWINDOW _
,$WS_GROUP,$WS_BORDER,$WS_CLIPSIBLINGS))
GUISetState(@SW_SHOW)
Else
ReDim $Array[UBound($Array) + 1][7]
EndIf
if StringRight($OutDir,1) == "\" Then $OutDir = StringTrimRight($OutDir,1)
if Not FileExists($OutDir) Then DirCreate($OutDir)
$FileName = StringSplit($link,"/")
$FileName = $FileName[$FileName[0]]
$OutDir &= "\" & $FileName
$Array[UBound($Array) - 1][0] = $link
$Array[UBound($Array) - 1][1] = $OutDir
$Array[UBound($Array) - 1][3] = GUICtrlCreateProgress(190, 10 + ((UBound($Array) - 1) * 30), 200, 20)
GUICtrlCreateLabel($FileName, 10, 10 + ((UBound($Array) - 1) * 30), 170, 20, BitOR($SS_CENTER,$WS_BORDER))
GUICtrlSetFont(-1, 10, 600, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0xFFFFFF)
$Array[UBound($Array) - 1][4] = GUICtrlCreateLabel("", 400, 10 + ((UBound($Array) - 1) * 30), 170, 20,BitOR($SS_CENTER,$WS_BORDER))
GUICtrlSetFont(-1, 10, 600, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0xFFFFFF)
$Array[UBound($Array) - 1][5]  = InetGet($Array[UBound($Array) - 1][0],$Array[UBound($Array) - 1][1], 1, 1)
Sleep(1500)
EndFunc
Edited by spymare
Link to comment
Share on other sites

this is to download them from a txt file:

#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

$file = FileOpen("links.txt", 0)
If $file = -1 Then
MsgBox(0, "Error", "Unable to open file.")
Exit
EndIf

$1 = FileReadLine($file, 1)
$2 = FileReadLine($file, 2)
$3 = FileReadLine($file, 3)
$4 = FileReadLine($file, 4)
$5 = FileReadLine($file, 5)
$6 = FileReadLine($file, 6)
$7 = FileReadLine($file, 7)
$8 = FileReadLine($file, 8)
$9 = FileReadLine($file, 9)
$10 = FileReadLine($file, 10)
$11 = FileReadLine($file, 11)
$12 = FileReadLine($file, 12)
$13 = FileReadLine($file, 13)
$14 = FileReadLine($file, 14)
$15 = FileReadLine($file, 15)
$16 = FileReadLine($file, 16)
$17 = FileReadLine($file, 17)
$18 = FileReadLine($file, 18)
$19 = FileReadLine($file, 19)
$20 = FileReadLine($file, 20)



Dim $Array , $complete = False
DownloadserMultiFiles($Array, $1, @ScriptDir & "\Downloads")
DownloadserMultiFiles($Array, $2, @ScriptDir & "\Downloads")
DownloadserMultiFiles($Array, $3, @ScriptDir & "\Downloads")
DownloadserMultiFiles($Array, $4, @ScriptDir & "\Downloads")
DownloadserMultiFiles($Array, $5, @ScriptDir & "\Downloads")
DownloadserMultiFiles($Array, $6, @ScriptDir & "\Downloads")
DownloadserMultiFiles($Array, $7, @ScriptDir & "\Downloads")
DownloadserMultiFiles($Array, $8, @ScriptDir & "\Downloads")
DownloadserMultiFiles($Array, $9, @ScriptDir & "\Downloads")
DownloadserMultiFiles($Array, $10, @ScriptDir & "\Downloads")
DownloadserMultiFiles($Array, $11, @ScriptDir & "\Downloads")
DownloadserMultiFiles($Array, $12, @ScriptDir & "\Downloads")
DownloadserMultiFiles($Array, $13, @ScriptDir & "\Downloads")
DownloadserMultiFiles($Array, $14, @ScriptDir & "\Downloads")
DownloadserMultiFiles($Array, $15, @ScriptDir & "\Downloads")
DownloadserMultiFiles($Array, $16, @ScriptDir & "\Downloads")
DownloadserMultiFiles($Array, $17, @ScriptDir & "\Downloads")
DownloadserMultiFiles($Array, $18, @ScriptDir & "\Downloads")
DownloadserMultiFiles($Array, $19, @ScriptDir & "\Downloads")
DownloadserMultiFiles($Array, $20, @ScriptDir & "\Downloads")

While 1
if $complete = False Then
$complete = ProgressLoop($Array,$complete)
Else
MsgBox(0,"","Downloads is complete")
Exit
EndIf
WEnd

Func ProgressLoop($Array,$complete = False)
if $complete = False Then
Dim $TempArray[1][7]
$complete = True
For $i = 0 To UBound($Array) - 1
Sleep(250)
$read = InetGetInfo($Array[$i][5],0)
$Size = InetGetInfo($Array[$i][5],1)
$Array[$i][6] += $read
$CompBool = InetGetInfo($Array[$i][5],2)
$error = @error
GUICtrlSetData($Array[$i][3],(100 / $Size) * $read)
GUICtrlSetData($Array[$i][4],"( " & StringLeft(int($read / 1024) / 1000 ,8) _
& " OF " & StringLeft(int($Size /1024) / 1000 ,8) & " ) MB")
if $CompBool = False And Not $error Then
$complete = False
$TempArray[UBound($TempArray) -1][0] = $Array[$i][0]
$TempArray[UBound($TempArray) -1][1] = $Array[$i][1]
$TempArray[UBound($TempArray) -1][2] = $Array[$i][2]
$TempArray[UBound($TempArray) -1][3] = $Array[$i][3]
$TempArray[UBound($TempArray) -1][4] = $Array[$i][4]
$TempArray[UBound($TempArray) -1][5] = $Array[$i][5]
$TempArray[UBound($TempArray) -1][6] = $Array[$i][6]
ReDim $TempArray[UBound($TempArray) +1][7]
Else
InetClose($Array[$i][5])
EndIf
Next
if $complete Then GUIDelete($Array[0][2])
if UBound($TempArray) > 1 Then
ReDim $TempArray[UBound($TempArray) - 1][7]
Else
$TempArray = 0
EndIf
$Array = $TempArray
Return $complete
EndIf
EndFunc

Func DownloadserMultiFiles(ByRef $Array,$link,$OutDir)
if Not IsArray($Array) Then
Dim $Array[1][7]
$Array[0][2] = GUICreate("QDownloader", 590, 140, 100, 200, _
BitOR($WS_MINIMIZEBOX,$WS_SYSMENU,$WS_CAPTION,$WS_POPUP,$WS_POPUPWINDOW _
,$WS_GROUP,$WS_BORDER,$WS_CLIPSIBLINGS))
GUISetState(@SW_SHOW)
Else
ReDim $Array[UBound($Array) + 1][7]
EndIf
if StringRight($OutDir,1) == "\" Then $OutDir = StringTrimRight($OutDir,1)
if Not FileExists($OutDir) Then DirCreate($OutDir)
$FileName = StringSplit($link,"/")
$FileName = $FileName[$FileName[0]]
$OutDir &= "\" & $FileName
$Array[UBound($Array) - 1][0] = $link
$Array[UBound($Array) - 1][1] = $OutDir
$Array[UBound($Array) - 1][3] = GUICtrlCreateProgress(190, 10 + ((UBound($Array) - 1) * 30), 200, 20)
GUICtrlCreateLabel($FileName, 10, 10 + ((UBound($Array) - 1) * 30), 170, 20, BitOR($SS_CENTER,$WS_BORDER))
GUICtrlSetFont(-1, 10, 600, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0xFFFFFF)
$Array[UBound($Array) - 1][4] = GUICtrlCreateLabel("", 400, 10 + ((UBound($Array) - 1) * 30), 170, 20,BitOR($SS_CENTER,$WS_BORDER))
GUICtrlSetFont(-1, 10, 600, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0xFFFFFF)
$Array[UBound($Array) - 1][5]  = InetGet($Array[UBound($Array) - 1][0],$Array[UBound($Array) - 1][1], 1, 1)
Sleep(1500)
EndFunc

Thank you :mellow:

$file = FileOpen("links.txt", 0)
$SpArray = StringSplit(FileRead($file),@LF)
For $i = 1 To $SpArray[0]
$Line = StringStripWS($SpArray[$i],3)
if $Line <> "" Then _
DownloaderMultiFiles($Array,$Line,@ScriptDir & "\Dir")
Next
FileClose($file)

صرح السماء كان هنا

 

Link to comment
Share on other sites

heres some suggestion.

a button in the gui to start it downloading all the files

and a button to pause all the downloads

and make the close program work :mellow: the X is not working.

also what really could be good, would be a overall progressbar, that indicates the % from 0 to 100 overall downloads.

and maybe a traymenu with some icons where you can choose to :

start all downloads

pause all downloads

cancel all downloads

manage - opens links.txt

setting - define where file should be saved, or how meny downloads should me started.

exit

Edited by spymare
Link to comment
Share on other sites

there's a bug with the schrollbar, witch only makes you able to see max 15 files being downloaded.

has maybe something to do with this line: _GUIScrollBars_Init($Array[0][2])

if i replace 2 with 3, there's no schrollbar, but i can resize the window so i can see more than 15 files being downloaded

Link to comment
Share on other sites

there's a bug with the schrollbar, witch only makes you able to see max 15 files being downloaded.

has maybe something to do with this line: _GUIScrollBars_Init($Array[0][2])

if i replace 2 with 3, there's no schrollbar, but i can resize the window so i can see more than 15 files being downloaded

Try this code

#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>

Dim $Array , $complete = False

$file = FileOpen("links.txt", 0)
$SpArray = StringSplit(FileRead($file),@LF)
For $i = 1 To $SpArray[0]
$Line = StringStripWS($SpArray[$i],3)
if $Line <> "" Then _
DownloaderMultiFiles($Array,$Line,@ScriptDir & "\Dir")
Next
FileClose($file)



;DownloaderMultiFiles($Array,"http://www.win-rar.com/downloads/wrar393.exe",@ScriptDir & "\Dir1")
;DownloaderMultiFiles($Array,"http://www.win-rar.com/downloads/wrar393bg.exe",@ScriptDir & "\Dir1")
;DownloaderMultiFiles($Array,"http://www.win-rar.com/downloads/wrar393.exe",@ScriptDir & "\Dir2")
;only 2 file in one time download in WinRar Site
;DownloaderMultiFiles($Array,"http://www.autoitscript.com/cgi-bin/getfile.pl?../autoit3/scite/" & _
;"download/SciTE4AutoIt3.exe",@ScriptDir & "\Dir2")

While 1
if $complete = False Then
$complete = ProgressLoop($Array,$complete)
Else
MsgBox(0,"","download is complete")
Exit
EndIf
WEnd

Func ProgressLoop($Array,$complete = False)
if $complete = False Then
Dim $TempArray[1][7]
$complete = True
For $i = 0 To UBound($Array) - 1
Sleep(250)
$read = InetGetInfo($Array[$i][5],0)
$Size = InetGetInfo($Array[$i][5],1)
$Array[$i][6] += $read
$CompBool = InetGetInfo($Array[$i][5],2)
$error = @error
GUICtrlSetData($Array[$i][3],(100 / $Size) * $read)
GUICtrlSetData($Array[$i][4],"( " & StringLeft(int($read / 1024) / 1000 ,8) _
& " OF " & StringLeft(int($Size /1024) / 1000 ,8) & " ) MB")
if $CompBool = False And Not $error Then
$complete = False
$TempArray[UBound($TempArray) -1][0] = $Array[$i][0]
$TempArray[UBound($TempArray) -1][1] = $Array[$i][1]
$TempArray[UBound($TempArray) -1][2] = $Array[$i][2]
$TempArray[UBound($TempArray) -1][3] = $Array[$i][3]
$TempArray[UBound($TempArray) -1][4] = $Array[$i][4]
$TempArray[UBound($TempArray) -1][5] = $Array[$i][5]
$TempArray[UBound($TempArray) -1][6] = $Array[$i][6]
ReDim $TempArray[UBound($TempArray) +1][7]
Else
InetClose($Array[$i][5])
EndIf
Next
if $complete Then GUIDelete($Array[0][2])
if UBound($TempArray) > 1 Then
ReDim $TempArray[UBound($TempArray) - 1][7]
Else
$TempArray = 0
EndIf
$Array = $TempArray
Return $complete
EndIf
EndFunc

Func DownloaderMultiFiles(ByRef $Array,$link,$OutDir)
if Not IsArray($Array) Then
Dim $Array[1][7]
$Array[0][2] = GUICreate("Downloader Progress", 590, 130, 100, 200, _
BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_SIZEBOX))
GUIRegisterMsg($WM_SIZE, "WM_SIZE")
GUIRegisterMsg($WM_VSCROLL, "WM_VSCROLL")
_GUIScrollBars_Init($Array[0][2])
GUISetState(@SW_SHOW)
Else
ReDim $Array[UBound($Array) + 1][7]
EndIf
if StringRight($OutDir,1) == "\" Then $OutDir = StringTrimRight($OutDir,1)
if Not FileExists($OutDir) Then DirCreate($OutDir)
$FileName = StringSplit($link,"/")
$FileName = $FileName[$FileName[0]]
$OutDir &= "\" & $FileName
$Array[UBound($Array) - 1][0] = $link
$Array[UBound($Array) - 1][1] = $OutDir
$Array[UBound($Array) - 1][3] = GUICtrlCreateProgress(190, 10 + ((UBound($Array) - 1) * 30), 200, 20)
GUICtrlCreateLabel($FileName, 10, 10 + ((UBound($Array) - 1) * 30), 170, 20, BitOR($SS_CENTER,$WS_BORDER))
GUICtrlSetFont(-1, 10, 600, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0xFFFFFF)
$Array[UBound($Array) - 1][4] = GUICtrlCreateLabel("", 400, 10 + ((UBound($Array) - 1) * 30), 170, 20,BitOR($SS_CENTER,$WS_BORDER))
GUICtrlSetFont(-1, 10, 600, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0xFFFFFF)
$Array[UBound($Array) - 1][5]  = InetGet($Array[UBound($Array) - 1][0],$Array[UBound($Array) - 1][1], 1, 1)
_Sleep(1500)
EndFunc

Func _Sleep($Time)
$begin = TimerInit()
While $Time > TimerDiff($begin)
WEnd
EndFunc

Func WM_SIZE($hWnd, $Msg, $wParam, $lParam)
    #forceref $Msg, $wParam
    Local $index = -1, $yChar, $xChar, $xClientMax, $xClient, $yClient, $ivMax
    For $x = 0 To UBound($aSB_WindowInfo) - 1
        If $aSB_WindowInfo[$x][0] = $hWnd Then
            $index = $x
            $xClientMax = $aSB_WindowInfo[$index][1]
            $xChar = $aSB_WindowInfo[$index][2]
            $yChar = $aSB_WindowInfo[$index][3]
            $ivMax = $aSB_WindowInfo[$index][7]
            ExitLoop
        EndIf
    Next
    If $index = -1 Then Return 0

    Local $tSCROLLINFO = DllStructCreate($tagSCROLLINFO)

    ; Retrieve the dimensions of the client area.
    $xClient = BitAND($lParam, 0x0000FFFF)
    $yClient = BitShift($lParam, 16)
    $aSB_WindowInfo[$index][4] = $xClient
    $aSB_WindowInfo[$index][5] = $yClient

    ; Set the vertical scrolling range and page size
    DllStructSetData($tSCROLLINFO, "fMask", BitOR($SIF_RANGE, $SIF_PAGE))
    DllStructSetData($tSCROLLINFO, "nMin", 0)
    DllStructSetData($tSCROLLINFO, "nMax", $ivMax)
    DllStructSetData($tSCROLLINFO, "nPage", $yClient / $yChar)
    _GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)

    ; Set the horizontal scrolling range and page size
    DllStructSetData($tSCROLLINFO, "fMask", BitOR($SIF_RANGE, $SIF_PAGE))
    DllStructSetData($tSCROLLINFO, "nMin", 0)
    DllStructSetData($tSCROLLINFO, "nMax", 2 + $xClientMax / $xChar)
    DllStructSetData($tSCROLLINFO, "nPage", $xClient / $xChar)
    _GUIScrollBars_SetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)

    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_SIZE

Func WM_VSCROLL($hWnd, $Msg, $wParam, $lParam)
    #forceref $Msg, $wParam, $lParam
    Local $nScrollCode = BitAND($wParam, 0x0000FFFF)
    Local $index = -1, $yChar, $yPos
    Local $Min, $Max, $Page, $Pos, $TrackPos

    For $x = 0 To UBound($aSB_WindowInfo) - 1
        If $aSB_WindowInfo[$x][0] = $hWnd Then
            $index = $x
            $yChar = $aSB_WindowInfo[$index][3]
            ExitLoop
        EndIf
    Next
    If $index = -1 Then Return 0


    ; Get all the vertial scroll bar information
    Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_VERT)
    $Min = DllStructGetData($tSCROLLINFO, "nMin")
    $Max = DllStructGetData($tSCROLLINFO, "nMax")
    $Page = DllStructGetData($tSCROLLINFO, "nPage")
    ; Save the position for comparison later on
    $yPos = DllStructGetData($tSCROLLINFO, "nPos")
    $Pos = $yPos
    $TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos")

    Switch $nScrollCode
        Case $SB_TOP ; user clicked the HOME keyboard key
            DllStructSetData($tSCROLLINFO, "nPos", $Min)

        Case $SB_BOTTOM ; user clicked the END keyboard key
            DllStructSetData($tSCROLLINFO, "nPos", $Max)

        Case $SB_LINEUP ; user clicked the top arrow
            DllStructSetData($tSCROLLINFO, "nPos", $Pos - 1)

        Case $SB_LINEDOWN ; user clicked the bottom arrow
            DllStructSetData($tSCROLLINFO, "nPos", $Pos + 1)

        Case $SB_PAGEUP ; user clicked the scroll bar shaft above the scroll box
            DllStructSetData($tSCROLLINFO, "nPos", $Pos - $Page)

        Case $SB_PAGEDOWN ; user clicked the scroll bar shaft below the scroll box
            DllStructSetData($tSCROLLINFO, "nPos", $Pos + $Page)

        Case $SB_THUMBTRACK ; user dragged the scroll box
            DllStructSetData($tSCROLLINFO, "nPos", $TrackPos)
    EndSwitch

;~    // Set the position and then retrieve it.  Due to adjustments
;~    //   by Windows it may not be the same as the value set.

    DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS)
    _GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)
    _GUIScrollBars_GetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)
    ;// If the position has changed, scroll the window and update it
    $Pos = DllStructGetData($tSCROLLINFO, "nPos")

    If ($Pos <> $yPos) Then
        _GUIScrollBars_ScrollWindow($hWnd, 0, $yChar * ($yPos - $Pos))
        $yPos = $Pos
    EndIf

    Return $GUI_RUNDEFMSG

EndFunc   ;==>WM_VSCROLL
Edited by wolf9228

صرح السماء كان هنا

 

Link to comment
Share on other sites

still only 15 downloads being showed in the gui, it can download more than 15 files, but does not show more than 15 files being downloaded, also thought it was the sleep timers

#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>

Dim $Array , $complete = False

$file = FileOpen("links.txt", 0)
$SpArray = StringSplit(FileRead($file),@LF)
For $i = 1 To $SpArray[0]
$Line = StringStripWS($SpArray[$i],3)
if $Line <> "" Then _
DownloaderMultiFiles($Array,$Line,@ScriptDir & "\Dir")
Next
FileClose($file)



;DownloaderMultiFiles($Array,"http://www.win-rar.com/downloads/wrar393.exe",@ScriptDir & "\Dir1")
;DownloaderMultiFiles($Array,"http://www.win-rar.com/downloads/wrar393bg.exe",@ScriptDir & "\Dir1")
;DownloaderMultiFiles($Array,"http://www.win-rar.com/downloads/wrar393.exe",@ScriptDir & "\Dir2")
;only 2 file in one time download in WinRar Site
;DownloaderMultiFiles($Array,"http://www.autoitscript.com/cgi-bin/getfile.pl?../autoit3/scite/" & _
;"download/SciTE4AutoIt3.exe",@ScriptDir & "\Dir2")

While 1
if $complete = False Then
$complete = ProgressLoop($Array,$complete)
Else
MsgBox(0,"","download is complete")
Exit
EndIf
WEnd

Func ProgressLoop($Array,$complete = False)
if $complete = False Then
Dim $TempArray[1][7]
$complete = True
For $i = 0 To UBound($Array) - 1
Sleep(250)
$read = InetGetInfo($Array[$i][5],0)
$Size = InetGetInfo($Array[$i][5],1)
$Array[$i][6] += $read
$CompBool = InetGetInfo($Array[$i][5],2)
$error = @error
GUICtrlSetData($Array[$i][3],(100 / $Size) * $read)
GUICtrlSetData($Array[$i][4],"( " & StringLeft(int($read / 1024) / 1000 ,8) _
& " OF " & StringLeft(int($Size /1024) / 1000 ,8) & " ) MB")
if $CompBool = False And Not $error Then
$complete = False
$TempArray[UBound($TempArray) -1][0] = $Array[$i][0]
$TempArray[UBound($TempArray) -1][1] = $Array[$i][1]
$TempArray[UBound($TempArray) -1][2] = $Array[$i][2]
$TempArray[UBound($TempArray) -1][3] = $Array[$i][3]
$TempArray[UBound($TempArray) -1][4] = $Array[$i][4]
$TempArray[UBound($TempArray) -1][5] = $Array[$i][5]
$TempArray[UBound($TempArray) -1][6] = $Array[$i][6]
ReDim $TempArray[UBound($TempArray) +1][7]
Else
InetClose($Array[$i][5])
EndIf
Next
if $complete Then GUIDelete($Array[0][2])
if UBound($TempArray) > 1 Then
ReDim $TempArray[UBound($TempArray) - 1][7]
Else
$TempArray = 0
EndIf
$Array = $TempArray
Return $complete
EndIf
EndFunc

Func DownloaderMultiFiles(ByRef $Array,$link,$OutDir)
if Not IsArray($Array) Then
Dim $Array[1][7]
$Array[0][2] = GUICreate("Downloader Progress", 590, 130, 100, 200, _
BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_SIZEBOX))
GUIRegisterMsg($WM_SIZE, "WM_SIZE")
GUIRegisterMsg($WM_VSCROLL, "WM_VSCROLL")
_GUIScrollBars_Init($Array[0][2],-1, 130)
GUISetState(@SW_SHOW)
Else
_GUIScrollBars_Init($Array[0][2],-1, 10 + ((UBound($Array) - 1) * 30))
ReDim $Array[UBound($Array) + 1][7]
EndIf
if StringRight($OutDir,1) == "\" Then $OutDir = StringTrimRight($OutDir,1)
if Not FileExists($OutDir) Then DirCreate($OutDir)
$FileName = StringSplit($link,"/")
$FileName = $FileName[$FileName[0]]
$OutDir &= "\" & $FileName
$Array[UBound($Array) - 1][0] = $link
$Array[UBound($Array) - 1][1] = $OutDir
$Array[UBound($Array) - 1][3] = GUICtrlCreateProgress(190, 10 + ((UBound($Array) - 1) * 30), 200, 20)
GUICtrlCreateLabel($FileName, 10, 10 + ((UBound($Array) - 1) * 30), 170, 20, BitOR($SS_CENTER,$WS_BORDER))
GUICtrlSetFont(-1, 10, 600, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0xFFFFFF)
$Array[UBound($Array) - 1][4] = GUICtrlCreateLabel("", 400, 10 + ((UBound($Array) - 1) * 30), 170, 20,BitOR($SS_CENTER,$WS_BORDER))
GUICtrlSetFont(-1, 10, 600, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0xFFFFFF)
$Array[UBound($Array) - 1][5]  = InetGet($Array[UBound($Array) - 1][0],$Array[UBound($Array) - 1][1], 1, 1)
_Sleep(1500)
EndFunc

Func _Sleep($Time)
$begin = TimerInit()
While $Time > TimerDiff($begin)
WEnd
EndFunc

Func WM_SIZE($hWnd, $Msg, $wParam, $lParam)
    #forceref $Msg, $wParam
    Local $index = -1, $yChar, $xChar, $xClientMax, $xClient, $yClient, $ivMax
    For $x = 0 To UBound($aSB_WindowInfo) - 1
        If $aSB_WindowInfo[$x][0] = $hWnd Then
            $index = $x
            $xClientMax = $aSB_WindowInfo[$index][1]
            $xChar = $aSB_WindowInfo[$index][2]
            $yChar = $aSB_WindowInfo[$index][3]
            $ivMax = $aSB_WindowInfo[$index][7]
            ExitLoop
        EndIf
    Next
    If $index = -1 Then Return 0

    Local $tSCROLLINFO = DllStructCreate($tagSCROLLINFO)

    ; Retrieve the dimensions of the client area.
    $xClient = BitAND($lParam, 0x0000FFFF)
    $yClient = BitShift($lParam, 16)
    $aSB_WindowInfo[$index][4] = $xClient
    $aSB_WindowInfo[$index][5] = $yClient

    ; Set the vertical scrolling range and page size
    DllStructSetData($tSCROLLINFO, "fMask", BitOR($SIF_RANGE, $SIF_PAGE))
    DllStructSetData($tSCROLLINFO, "nMin", 0)
    DllStructSetData($tSCROLLINFO, "nMax", $ivMax)
    DllStructSetData($tSCROLLINFO, "nPage", $yClient / $yChar)
    _GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)

    ; Set the horizontal scrolling range and page size
    DllStructSetData($tSCROLLINFO, "fMask", BitOR($SIF_RANGE, $SIF_PAGE))
    DllStructSetData($tSCROLLINFO, "nMin", 0)
    DllStructSetData($tSCROLLINFO, "nMax", 2 + $xClientMax / $xChar)
    DllStructSetData($tSCROLLINFO, "nPage", $xClient / $xChar)
    _GUIScrollBars_SetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)

    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_SIZE

Func WM_VSCROLL($hWnd, $Msg, $wParam, $lParam)
    #forceref $Msg, $wParam, $lParam
    Local $nScrollCode = BitAND($wParam, 0x0000FFFF)
    Local $index = -1, $yChar, $yPos
    Local $Min, $Max, $Page, $Pos, $TrackPos

    For $x = 0 To UBound($aSB_WindowInfo) - 1
        If $aSB_WindowInfo[$x][0] = $hWnd Then
            $index = $x
            $yChar = $aSB_WindowInfo[$index][3]
            ExitLoop
        EndIf
    Next
    If $index = -1 Then Return 0


    ; Get all the vertial scroll bar information
    Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_VERT)
    $Min = DllStructGetData($tSCROLLINFO, "nMin")
    $Max = DllStructGetData($tSCROLLINFO, "nMax")
    $Page = DllStructGetData($tSCROLLINFO, "nPage")
    ; Save the position for comparison later on
    $yPos = DllStructGetData($tSCROLLINFO, "nPos")
    $Pos = $yPos
    $TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos")

    Switch $nScrollCode
        Case $SB_TOP ; user clicked the HOME keyboard key
            DllStructSetData($tSCROLLINFO, "nPos", $Min)

        Case $SB_BOTTOM ; user clicked the END keyboard key
            DllStructSetData($tSCROLLINFO, "nPos", $Max)

        Case $SB_LINEUP ; user clicked the top arrow
            DllStructSetData($tSCROLLINFO, "nPos", $Pos - 1)

        Case $SB_LINEDOWN ; user clicked the bottom arrow
            DllStructSetData($tSCROLLINFO, "nPos", $Pos + 1)

        Case $SB_PAGEUP ; user clicked the scroll bar shaft above the scroll box
            DllStructSetData($tSCROLLINFO, "nPos", $Pos - $Page)

        Case $SB_PAGEDOWN ; user clicked the scroll bar shaft below the scroll box
            DllStructSetData($tSCROLLINFO, "nPos", $Pos + $Page)

        Case $SB_THUMBTRACK ; user dragged the scroll box
            DllStructSetData($tSCROLLINFO, "nPos", $TrackPos)
    EndSwitch

;~    // Set the position and then retrieve it.  Due to adjustments
;~    //   by Windows it may not be the same as the value set.

    DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS)
    _GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)
    _GUIScrollBars_GetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)
    ;// If the position has changed, scroll the window and update it
    $Pos = DllStructGetData($tSCROLLINFO, "nPos")

    If ($Pos <> $yPos) Then
        _GUIScrollBars_ScrollWindow($hWnd, 0, $yChar * ($yPos - $Pos))
        $yPos = $Pos
    EndIf

    Return $GUI_RUNDEFMSG

EndFunc   ;==>WM_VSCROLL

صرح السماء كان هنا

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...