Jump to content

help.. with download


Recommended Posts

ok i need help with a script that downloads a file...

Sorry but the game website int up yet so i used Autoit download...

I get error for while and Wend...

Also is there any way to change tyhe progress bar to being the one in the GUI alos it has download number/number under that can it have estimated time plz...

I know ur not my slaves so if you could just help me or if your kind enough do it plz...

here is code

#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Zap Games -Downloader", 624, 187, 193, 115)
GUISetBkColor(0xA6CAF0)
$Pic1 = GUICtrlCreatePic("C:\Documents and Settings\Windows\Desktop\sqside.bmp", 400, 64, 68, 68, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
$Progress1 = GUICtrlCreateProgress(8, 152, 502, 17)
$Label1 = GUICtrlCreateLabel("Welcome to Zap Games - Installer... This Downloader is set to Download Time- The Buring Destructor", 8, 16, 482, 17)
$Label2 = GUICtrlCreateLabel("The download will start when you click Download now...", 8, 40, 269, 17)
$Label3 = GUICtrlCreateLabel("The file size should be", 8, 64, 109, 17)
$Button1 = GUICtrlCreateButton("(Not allowed)", 160, 88, 204, 54, $BS_BITMAP)
GUICtrlSetImage(-1, "C:\Documents and Settings\Windows\Desktop\Dl Now.bmp", 0)
TrayItemSetOnEvent(-1, "Dload")
$Pic2 = GUICtrlCreatePic("C:\Documents and Settings\Windows\Desktop\side.bmp", 520, 0, 100, 180, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
Wend 


Func Dload()
    
$DownloadURL = "http://www.autoitscript.com/autoit3/files/beta/autoit/autoit-v3.2.3.14-beta-setup.exe"
$FileName = StringRight($DownloadURL,StringLen($DownloadURL) - StringInStr($DownloadURL,"/",0,-1))
$size = InetGetSize($DownloadURL)

InetGet($DownloadURL,@scriptdir & "\" & $FileName, 1, 1)

ProgressOn("Downloading " & $FileName,"")
     While @InetGetActive
          $prog = (100 * @InetGetBytesRead) / $size
          ProgressSet($prog, @InetGetBytesRead & "/" & $size & " bytes", "Downloading")
          Sleep(250)
     WEnd
ProgressOff()

            Exit

    EndSwitch
    
    EndFunc ;>~~ Dload end

thanks in advance... :whistle:

Edited by SalazarCheats

Ok im 14 with a spelling age of a 9 year old... that explanes all my spelling mistakes

Link to comment
Share on other sites

  • Developers

something is definately wrong:

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
        WEnd
;### Tidy Error -> switch Not closed before "Func" statement.
;### Tidy Error ->  & CHR$(34) & FIRSTWORD$ & " cannot be inside any IF/Do/While/For/Case/Func statement.
        Func Dload()
            $DownloadURL = "http://www.autoitscript.com/autoit3/files/beta/autoit/autoit-v3.2.3.14-beta-setup.exe"
            $FileName = StringRight($DownloadURL, StringLen($DownloadURL) - StringInStr($DownloadURL, "/", 0, -1))
            $size = InetGetSize($DownloadURL)
            InetGet($DownloadURL, @ScriptDir & "\" & $FileName, 1, 1)
            ProgressOn("Downloading " & $FileName, "")
            While @InetGetActive
                $prog = (100 * @InetGetBytesRead) / $size
                ProgressSet($prog, @InetGetBytesRead & "/" & $size & " bytes", "Downloading")
                Sleep(250)
            WEnd
            ProgressOff()
            Exit
    EndSwitch
;### Tidy Error -> "endfunc" is closing previous "while"
EndFunc  ;==>Dload

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

something is definately wrong:

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
        WEnd
;### Tidy Error -> switch Not closed before "Func" statement.
;### Tidy Error ->  & CHR$(34) & FIRSTWORD$ & " cannot be inside any IF/Do/While/For/Case/Func statement.
        Func Dload()
            $DownloadURL = "http://www.autoitscript.com/autoit3/files/beta/autoit/autoit-v3.2.3.14-beta-setup.exe"
            $FileName = StringRight($DownloadURL, StringLen($DownloadURL) - StringInStr($DownloadURL, "/", 0, -1))
            $size = InetGetSize($DownloadURL)
            InetGet($DownloadURL, @ScriptDir & "\" & $FileName, 1, 1)
            ProgressOn("Downloading " & $FileName, "")
            While @InetGetActive
                $prog = (100 * @InetGetBytesRead) / $size
                ProgressSet($prog, @InetGetBytesRead & "/" & $size & " bytes", "Downloading")
                Sleep(250)
            WEnd
            ProgressOff()
            Exit
    EndSwitch
;### Tidy Error -> "endfunc" is closing previous "while"
EndFunc ;==>Dload
can you help...

Ok im 14 with a spelling age of a 9 year old... that explanes all my spelling mistakes

Link to comment
Share on other sites

yes i have tried...

EDIT: Fixed to errors....

#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Zap Games -Downloader", 624, 187, 193, 115)
GUISetBkColor(0xA6CAF0)
$Pic1 = GUICtrlCreatePic("C:\Documents and Settings\Windows\Desktop\sqside.bmp", 400, 64, 68, 68, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
$Progress1 = GUICtrlCreateProgress(8, 152, 502, 17)
$Label1 = GUICtrlCreateLabel("Welcome to Zap Games - Installer... This Downloader is set to Download Time- The Buring Destructor", 8, 16, 482, 17)
$Label2 = GUICtrlCreateLabel("The download will start when you click Download now...", 8, 40, 269, 17)
$Label3 = GUICtrlCreateLabel("The file size should be", 8, 64, 109, 17)
$Button1 = GUICtrlCreateButton("(Not allowed)", 160, 88, 204, 54, $BS_BITMAP)
GUICtrlSetImage(-1, "C:\Documents and Settings\Windows\Desktop\Dl Now.bmp", 0)
TrayItemSetOnEvent(-1, "Dload")
$Pic2 = GUICtrlCreatePic("C:\Documents and Settings\Windows\Desktop\side.bmp", 520, 0, 100, 180, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
    EndSwitch
Wend 


Func Dload()
    
$DownloadURL = "http://www.autoitscript.com/autoit3/files/beta/autoit/autoit-v3.2.3.14-beta-setup.exe"
$FileName = StringRight($DownloadURL,StringLen($DownloadURL) - StringInStr($DownloadURL,"/",0,-1))
$size = InetGetSize($DownloadURL)

InetGet($DownloadURL,@scriptdir & "\" & $FileName, 1, 1)

ProgressOn("Downloading " & $FileName,"")
     While @InetGetActive
          $prog = (100 * @InetGetBytesRead) / $size
          ProgressSet($prog, @InetGetBytesRead & "/" & $size & " bytes", "Downloading")
          Sleep(250)
     WEnd
ProgressOff()

            Exit
    
    EndFunc ;>~~ Dload end

Any more errors

that u find...

Edited by SalazarCheats

Ok im 14 with a spelling age of a 9 year old... that explanes all my spelling mistakes

Link to comment
Share on other sites

  • Developers

yes i have tried...

Wrong answer...

You need to understand your own scripts... its as simple as that.

Look through your script and think about what its supposed to do ...then apply the correct syntax for it ...

:whistle:

Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
Wend

what is this part supposed to do ? couse i think its wrong from the base ?

IDK... i got if form koda...

Anyway look at post 5 and you will see i edited my script...

Ok im 14 with a spelling age of a 9 year old... that explanes all my spelling mistakes

Link to comment
Share on other sites

IDK... i got if form koda...

Anyway look at post 5 and you will see i edited my script...

either u took it from his script and deleted some stuff or i dont know couse whats the point of a swith and a Case if u have no Statements

replace it with

While 1
    sleep(100)
Wend

and it will work just as good

Link to comment
Share on other sites

either u took it from his script and deleted some stuff or i dont know couse whats the point of a swith and a Case if u have no Statements

replace it with

While 1
    sleep(100)
Wend

and it will work just as good

the install is not mine but the gui is...

and the button is not showing pic...

Ok im 14 with a spelling age of a 9 year old... that explanes all my spelling mistakes

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...