dabus Posted May 23, 2005 Share Posted May 23, 2005 (edited) I know there is InetGet to count Bytes for me if I use http/ftp , but I want to copy a file from one drive to another ( say c:\file.img to d:\ ) and have a progressbar like the one I get if I copy files via the explorer.exe. Windows seems to give me the reserved disk-space, so FileGetSize will not work. Any idea, how to get this going? Edited May 23, 2005 by dabus Link to comment Share on other sites More sharing options...
GaryFrost Posted May 23, 2005 Share Posted May 23, 2005 Take a look at the following linkhttp://www.autoitscript.com/forum/index.php?showtopic=11313 SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
dabus Posted May 23, 2005 Author Share Posted May 23, 2005 I'm not that pro but it seems to me like this is a script to copy dirs. I've got a single file. It is copied to a Intranet-share. And it takes a while since the bandwidth is not that big... I would like to know how many kilobytes are transferred, just to have some kind of imagination, how long it will take to get it done. So it's kinda inverse-inetget: I would call it inetput. Link to comment Share on other sites More sharing options...
GaryFrost Posted May 23, 2005 Share Posted May 23, 2005 (edited) Here's one I was messing around with awhile back, don't remember where I left off on it, but might help you with what your looking for. Edit: Sorry, noticed it requires Beta version of AutoIt. expandcollapse popup; ---------------------------------------------------------------------------- ; ; AutoIt Version: 3.1.1++ ; Author: A.N.Other <myemail@nowhere.com> ; ; Script Function: ; Template AutoIt script. ; ; ---------------------------------------------------------------------------- ; Script Start - Add your code below here #Include <string.au3> #include <GUIConstants.au3> ProcessSetPriority("AutoIt3.exe", 0) GUICreate("Downloader", 400, 230, -1, -1, BitOR($WS_SIZEBOX,$WS_SYSMENU),$WS_EX_ACCEPTFILES) $myEdit = GUICtrlCreateInput("Paste URL here.", 0, 0, 400, 20) ;$myEdit = GUICtrlCreateInput("@DesktopDir & "\"", 0, 0, 400, 20) GUICtrlSetState(-1,$GUI_ACCEPTFILES) ;;labels $KBpsInput = GUICtrlCreateInput(0, 4, 48, 55, 17, $ES_RIGHT) $KBps = GUICtrlCreateLabel("KBps", 63, 50, 250) $downloadedSoFarInput = GUICtrlCreateInput(0, 4, 70, 55, 17, $ES_RIGHT) $downloadedSoFar = GUICtrlCreateLabel("MB done", 63, 72, 250) $lefToDownloadInput = GUICtrlCreateInput(0, 4, 92, 55, 17, $ES_RIGHT) $leftToDownload = GUICtrlCreateLabel("MB left", 63, 94, 250) $timeElapsedInput = GUICtrlCreateInput(0, 4, 114, 55, 17, $ES_RIGHT) $timeElapsed = GUICtrlCreateLabel("Minutes so far", 63, 116, 250) $timeRemainingInput = GUICtrlCreateInput(0, 4, 136, 55, 17, $ES_RIGHT) $timeRemaining = GUICtrlCreateLabel("Minutes left", 63, 137, 250) $percentElapsedInput = GUICtrlCreateInput(0, 4, 158, 55, 17, $ES_RIGHT) $percentElapsed = GUICtrlCreateLabel("% complete", 63, 161, 250) $percentRemainingInput = GUICtrlCreateInput(0, 4, 180, 55, 17, $ES_RIGHT) $percentRemaining = GUICtrlCreateLabel("% remaining", 63, 182, 300) ;others $button = GUICtrlCreateButton("Download", 3, 23, 60, 20, $BS_CENTER + $BS_VCENTER + $BS_DEFPUSHBUTTON) $cancel = GUICtrlCreateButton("Cancel", 65, 23, 60, 20, $BS_CENTER + $BS_VCENTER) GUICtrlSetState($cancel, $GUI_DISABLE) ;$progressBar = GUICtrlCreateProgress(135, 25, 15, 173, $PBS_SMOOTH) GUICtrlCreateLabel("Download Location:", 135, 135, 300) GUICtrlCreateLabel(@DesktopDir & "\", 135, 150, 300) $progressBar = GUICtrlCreateProgress(135, 182, 173, 15, $PBS_SMOOTH) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $cancel Then InetGet("abort") GUICtrlSetState($button, $GUI_ENABLE) GUICtrlSetState($cancel, $GUI_DISABLE) EndIf If $msg = $button Then Call("download") GUICtrlSetState($button, $GUI_DISABLE) GUICtrlSetState($cancel, $GUI_ENABLE) EndIf WEnd Func download() Global $url = GUICtrlRead($myEdit) Global $fileSize = InetGetSize($url) Global $startDownloadTime = TimerInit() InetGet($url, @DesktopDir & "\" & StringRight($url, StringInStr(_StringReverse($url), "/") - 1), 0, 1) AdlibEnable("progress", 1000) EndFunc;==>download Func progress() If @InetGetActive Then GUICtrlSetData($KBpsInput, StringFormat("%.3f", (@InetGetBytesRead / 1024) / ( (TimerDiff($startDownloadTime) / 1000)))) GUICtrlSetData($downloadedSoFarInput, StringFormat("%.2f", (@InetGetBytesRead / 1024) / 1024)) GUICtrlSetData($lefToDownloadInput, StringFormat("%.2f", ($fileSize / 1024) - (@InetGetBytesRead / 1024) / 1024)) GUICtrlSetData($timeElapsedInput, StringFormat("%.2f", 60 - (3600000 - TimerDiff($startDownloadTime)) / 60000)) GUICtrlSetData($timeRemainingInput, StringFormat("%.2f", 60 - (3600000 - ( ($fileSize - @InetGetBytesRead) / @InetGetBytesRead) * TimerDiff($startDownloadTime)) / 60000)) GUICtrlSetData($percentElapsedInput, StringFormat("%.2f", (@InetGetBytesRead / $fileSize) * 100)) GUICtrlSetData($percentRemainingInput, StringFormat("%.2f", (100 - (@InetGetBytesRead / $fileSize) * 100))) GUICtrlSetData($progressBar, (@InetGetBytesRead / $fileSize) * 100) EndIf If @InetGetActive = 0 Then GUICtrlSetState($button, $GUI_ENABLE) GUICtrlSetState($cancel, $GUI_DISABLE) AdlibDisable() EndIf EndFunc;==>progress Edited May 23, 2005 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
dabus Posted May 25, 2005 Author Share Posted May 25, 2005 Never thought inetget would work with file://c:\file.img. Would be nice if someone could write this in the Help-File -- maybe I'm not the only one that doesn't would like to copy files in background-mode. 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