CyberAssassin Posted February 23, 2008 Share Posted February 23, 2008 Hi Ive made a simple gui for wGet. So far the whole thing works but Im trying to incorporate a status bar into it. Based upon the size of the file on the server and then it would compare that to the size of the downloaded file. Any Ideas? Here is what I have so far. #include<GUIconstants.au3> #include<Process.au3> GUICreate("Wget",300,75,-1,-1,-1) GUISetState() $input = GUICtrlCreateInput("Enter URL here", 1, 1, 298, 45) $get = GUICtrlCreateButton("Get!", 0, 50, 300, 25) $progress = GUICtrlCreateProgress(2, 46, 298, 5, $PBS_SMOOTH) While 1 Sleep(100) $gMsg = GUIGetMsg() Switch $gMsg Case $GUI_EVENT_CLOSE Exit Case $get _get() EndSwitch WEnd Func _get() $input = GUICtrlRead($input) $filesize = InetGetSize($input) Run("wget.exe " & $input) EndFunc Link to comment Share on other sites More sharing options...
flyingboz Posted February 23, 2008 Share Posted February 23, 2008 wget has a --progress option, you could parse the console output and make your progress indicator using the stdio functions. Note that they have dramatically changed with the new beta...Ensure you download / program against that unless you want to do it twice. Reading the help file before you post... Not only will it make you look smarter, it will make you smarter. Link to comment Share on other sites More sharing options...
NELyon Posted February 23, 2008 Share Posted February 23, 2008 Why not just use INetGet? o.0 Link to comment Share on other sites More sharing options...
flyingboz Posted February 23, 2008 Share Posted February 23, 2008 Why not just use INetGet?o.0Compare featuresets of the two methodologies, grasshopper. jvanegmond 1 Reading the help file before you post... Not only will it make you look smarter, it will make you smarter. Link to comment Share on other sites More sharing options...
nobbe Posted February 23, 2008 Share Posted February 23, 2008 hi the progress bar is rather jumpy on my machine , but it works expandcollapse popup; ----------------------------------------------------------------------------------------------- #include <GUIConstants.au3> #include <String.au3> #include <GUIStatusBar.au3> #Region ### START Koda GUI section ### Form= $GUI = GUICreate("", 612, 387, 193, 115) $edit_input = GUICtrlCreateInput("", 16, 48, 449, 21) $btn_download = GUICtrlCreateButton("Download", 480, 48, 75, 25, 0) $progress = GUICtrlCreateProgress(16, 120, 446, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg ;; do a single Download .. Case $btn_download GUICtrlSetState($btn_download, $GUI_DISABLE) $dwnlink = GUICtrlRead($edit_input) _download_this_url($dwnlink, 0) ; unattended == 0?? ;; close Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd ; Func _download_this_url($url, $unattended) GUICtrlSetData($progress, 0) ;; progress bar $c = "wget.exe " & ' "' & $url & '"' $pid = Run($c, @ScriptDir, @SW_HIDE, $STDERR_CHILD) ProcessSetPriority($pid, 0) ;; lowest $streamcounter = 0 ;; thsi is rather jumpy on my machine While ProcessExists($pid) If 1 <= $streamcounter Then $readstream = StderrRead($pid);,0,true) ; ClipPut($readstream); ; MsgBox(0, "%", $readstream); ;; read % $tmp = _StringBetween($readstream, ".....", '%') If @error <> 1 Then $percent = StringReplace($tmp[0], ".", ""); $percent = StringStripWS($percent, "7"); GUICtrlSetData($progress, $percent) ;; progress bar ; MsgBox(0, "%", $percent); EndIf ;; found duration ?? $streamcounter = 0 EndIf $streamcounter = $streamcounter + 1 WEnd GUICtrlSetData($progress, 100) ;; progress bar EndFunc ;==>_download_this_url Link to comment Share on other sites More sharing options...
stormbreaker Posted March 30, 2012 Share Posted March 30, 2012 Flyingboz is right. InetGet commands are unusable on PC's with no Internet Explorer Components (such as European editions of MS-Windows). However, using output from Console proves to be more versatile and usable.Regards ---------------------------------------- :bye: Hey there, was I helpful? ---------------------------------------- My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 30, 2012 Moderators Share Posted March 30, 2012 MKISH, We discourage necro-posting in threads after more than a year or so - tha language has changed so much it makes little sense to reopen them. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area 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