MerkurAlex Posted July 4, 2007 Share Posted July 4, 2007 i was wondering if someone could give me an example of a download using a progress bar to check the download percent [quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote] Link to comment Share on other sites More sharing options...
MerkurAlex Posted July 5, 2007 Author Share Posted July 5, 2007 no one knows? [quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote] Link to comment Share on other sites More sharing options...
ChrisL Posted July 5, 2007 Share Posted July 5, 2007 $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() [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
weaponx Posted July 5, 2007 Share Posted July 5, 2007 Dammit you beat me to it. I'm posting anyways. $URL = "http://www.rarlab.com/rar/wrar370.exe" $FILENAME = "wrar370.exe" $FILESIZE = InetGetSize ( $URL ) InetGet($URL, $FILENAME, 1, 1) ProgressOn("Download progress", "", "0%") While @InetGetActive $PERCENT = Int((@InetGetBytesRead / $FILESIZE) * 100) ProgressSet( $PERCENT, $PERCENT & " %") ;TrayTip("Downloading", "Bytes = " & @InetGetBytesRead & @CRLF & $PERCENT & " %", 10, 16) ;Enable sleep to reduce flickering ;Sleep(250) Wend Link to comment Share on other sites More sharing options...
weaponx Posted July 5, 2007 Share Posted July 5, 2007 ChrisL your method for determining the filename is odd. You should just use: $A = StringSplit($URL, "/") $FILENAME = $A[$A[0]] Link to comment Share on other sites More sharing options...
tAKTelapis Posted July 5, 2007 Share Posted July 5, 2007 Hmm, i noted the differences, and figured i would have a crack at combining them, just because i was bored, here is my attempt (i added a way to cancel th download) $FileUrl = "http://www.autoitscript.com/autoit3/files/beta/autoit/autoit-v3.2.3.14-beta-setup.exe" $FileSize = InetGetSize($FileUrl) $FileName = StringSplit($FileUrl, "/") $FileName = $FileName[$FileName[0]] InetGet($FileUrl,@scriptdir & "\" & $FileName, 1, 1) HotKeySet("{ESC}", "_InetGetAbort") ProgressOn("Download progress for "&$FileName, "", "0%") While @InetGetActive $Prog = Int((100 * @InetGetBytesRead) / $FileSize) ProgressSet($prog, @InetGetBytesRead & "/" & $FileSize & " bytes", "Downloading "&$FileName) Sleep(250) WEnd Func _InetGetAbort() InetGet("abort") EndFunc ;==> _InetGetAbort() Link to comment Share on other sites More sharing options...
MerkurAlex Posted July 5, 2007 Author Share Posted July 5, 2007 thanks guys. [quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote] Link to comment Share on other sites More sharing options...
ChrisL Posted July 5, 2007 Share Posted July 5, 2007 ChrisL your method for determining the filename is odd. You should just use: $A = StringSplit($URL, "/") $FILENAME = $A[$A[0]] We get the same result don't we [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
weaponx Posted July 5, 2007 Share Posted July 5, 2007 I save .018 milliseconds ; Script Start - Add your code below here $URL = "http://www.rarlab.com/rar/wrar370.exe" ;Benchmark 1 $TIMER1 = TimerInit () $A = StringSplit($URL, "/") $FILENAME = $A[$A[0]] $L1 = TimerDiff ($TIMER1) ;Benchmark 2 $TIMER2 = TimerInit () $FileName = StringRight($URL,StringLen($URL) - StringInStr($URL,"/",0,-1)) $L2 = TimerDiff ($TIMER2) MsgBox(0,"","Timer1: " & $L1 & @CRLF & "Timer2: " & $L2 & @CRLF & "Difference: " & ($L2 - $L1) & "ms") Link to comment Share on other sites More sharing options...
ChrisL Posted July 5, 2007 Share Posted July 5, 2007 I save .018 millisecondsWin some loose some I'd say [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
weaponx Posted July 5, 2007 Share Posted July 5, 2007 Win some loose some I'd saylol I was just joking. Speed definitely isn't an issue in this case but if it had to be done 100,000 times there would be a noticeable difference. Link to comment Share on other sites More sharing options...
ChrisL Posted July 5, 2007 Share Posted July 5, 2007 lol I was just joking. Speed definitely isn't an issue in this case but if it had to be done 100,000 times there would be a noticeable difference. Did you look at the attachment? On my laptop sometimes yours was faster and sometimes mine was. I think it depends on which way the wind is blowing [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
SalazarCheats Posted July 5, 2007 Share Posted July 5, 2007 Did you look at the attachment? On my laptop sometimes yours was faster and sometimes mine was. I think it depends on which way the wind is blowing can you but this in a gui with abutton to start it/... 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 More sharing options...
MrCreatoR Posted July 5, 2007 Share Posted July 5, 2007 You can get the name even easyer... $FileName = StringRegExpReplace($URL, "^.*\\", "") Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
weaponx Posted July 5, 2007 Share Posted July 5, 2007 You can get the name even easyer... $FileName = StringRegExpReplace($URL, "^.*\\", "")oÝ÷ Øÿêº^Jè} EjË^²ÛޮȨ'jëh×6; Script Start - Add your code below here $URL = "http://www.rarlab.com/rar/wrar370.exe" ;Benchmark 1 $TIMER1 = TimerInit () $A = StringSplit($URL, "/") $FILENAME = $A[$A[0]] $L1 = TimerDiff ($TIMER1) ;Benchmark 2 $TIMER2 = TimerInit () $FileName = StringRight($URL,StringLen($URL) - StringInStr($URL,"/",0,-1)) $L2 = TimerDiff ($TIMER2) ;Benchmark 3 $TIMER3 = TimerInit () $FileName = StringRegExpReplace($URL, "^.*\\", "") $L3 = TimerDiff ($TIMER3) MsgBox(0,"","Timer1: " & $L1 & @CRLF & "Timer2: " & $L2 & @CRLF & "Timer3: " & $L3) Link to comment Share on other sites More sharing options...
MrCreatoR Posted July 6, 2007 Share Posted July 6, 2007 For URL i forgot, it must be with one backslash: $FileName = StringRegExpReplace($URL, "^.*/", "") Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
sysman Posted August 16, 2007 Share Posted August 16, 2007 Hmm, i noted the differences, and figured i would have a crack at combining them, just because i was bored, here is my attempt (i added a way to cancel th download) $FileUrl = "http://www.autoitscript.com/autoit3/files/beta/autoit/autoit-v3.2.3.14-beta-setup.exe" $FileSize = InetGetSize($FileUrl) $FileName = StringSplit($FileUrl, "/") $FileName = $FileName[$FileName[0]] InetGet($FileUrl,@scriptdir & "\" & $FileName, 1, 1) HotKeySet("{ESC}", "_InetGetAbort") ProgressOn("Download progress for "&$FileName, "", "0%") While @InetGetActive $Prog = Int((100 * @InetGetBytesRead) / $FileSize) ProgressSet($prog, @InetGetBytesRead & "/" & $FileSize & " bytes", "Downloading "&$FileName) Sleep(250) WEnd Func _InetGetAbort() InetGet("abort") EndFunc ;==> _InetGetAbort() Just a litle question? Why do I get an empty file Can someone help me Link to comment Share on other sites More sharing options...
Memnoch Posted August 16, 2007 Share Posted August 16, 2007 (edited) Excuse me for interrupting the willy waving but does anytone know if there is a way of having the progress bar follow a data transfer without using InetGet? Edited August 16, 2007 by Memnoch Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now