flxfxp Posted April 29, 2009 Share Posted April 29, 2009 Is it possible to stop/halt/kill/whatever a InetGet in process of downloading? Thanks, Dennis Link to comment Share on other sites More sharing options...
Authenticity Posted April 29, 2009 Share Posted April 29, 2009 Look again at the function description and remarks in the help file. You can specify 1 in the last argument and the function will return immediately. Link to comment Share on other sites More sharing options...
Yashied Posted April 29, 2009 Share Posted April 29, 2009 ... and then InetGet("abort"). My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
flxfxp Posted April 30, 2009 Author Share Posted April 30, 2009 InetGet("abort") doesnt seem to work? I created the following: expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Gamedler", 291, 236, 193, 125) $Button1 = GUICtrlCreateButton("Button1", 200, 16, 75, 25, 0) ;left, top, width, height $Progress1 = GUICtrlCreateProgress(20, 64, 150, 15) $Label1 = GUICtrlCreateLabel("Label1", 32, 32, 252, 17) $Button2 = GUICtrlCreateButton("Button2", 200, 56, 75, 25, 0) $Button3 = GUICtrlCreateButton("Button3", 200, 96, 75, 25, 0) $Exit = GUICtrlCreateButton("Exit", 208, 192, 51, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $Button1 $FileURL = "http://www.flx.me/installr.exe" $FileName = "installr.exe" $FileSaveLocation = FileSaveDialog("Save Location...",@ScriptDir,"All (*.*)",18,$FileName) $FileSize = InetGetSize($FileURL) InetGet($FileURL,$FileName,1,1) ;ProgressOn("","") While @InetGetActive $Percentage = @InetGetBytesRead * 100 / $FileSize $SizeMB = $FileSize / 1024 / 1024 $StatMB = @InetGetBytesRead / 1024 / 1024 $PercentageGUI = int(@InetGetBytesRead/$FileSize*100) & "%" GUICtrlSetData($Progress1, $Percentage) GUICtrlSetData($Label1, $PercentageGUI & " " & int(@InetGetBytesRead/1024)&"kB of "&int($FileSize/1024)&"kB") Sleep(250) Wend ;ProgressOff() MsgBox(0, "Done","Download Complete!") Case $Button2 InetGet("abort") Case $Exit Exit Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Help is greatly appreciated Link to comment Share on other sites More sharing options...
Yashied Posted April 30, 2009 Share Posted April 30, 2009 InetGet("abort") doesnt seem to work? I created the following: expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Gamedler", 291, 236, 193, 125) $Button1 = GUICtrlCreateButton("Button1", 200, 16, 75, 25, 0) ;left, top, width, height $Progress1 = GUICtrlCreateProgress(20, 64, 150, 15) $Label1 = GUICtrlCreateLabel("Label1", 32, 32, 252, 17) $Button2 = GUICtrlCreateButton("Button2", 200, 56, 75, 25, 0) $Button3 = GUICtrlCreateButton("Button3", 200, 96, 75, 25, 0) $Exit = GUICtrlCreateButton("Exit", 208, 192, 51, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $Button1 $FileURL = "http://www.flx.me/installr.exe" $FileName = "installr.exe" $FileSaveLocation = FileSaveDialog("Save Location...",@ScriptDir,"All (*.*)",18,$FileName) $FileSize = InetGetSize($FileURL) InetGet($FileURL,$FileName,1,1) ;ProgressOn("","") While @InetGetActive $Percentage = @InetGetBytesRead * 100 / $FileSize $SizeMB = $FileSize / 1024 / 1024 $StatMB = @InetGetBytesRead / 1024 / 1024 $PercentageGUI = int(@InetGetBytesRead/$FileSize*100) & "%" GUICtrlSetData($Progress1, $Percentage) GUICtrlSetData($Label1, $PercentageGUI & " " & int(@InetGetBytesRead/1024)&"kB of "&int($FileSize/1024)&"kB") Sleep(250) Wend ;ProgressOff() MsgBox(0, "Done","Download Complete!") Case $Button2 InetGet("abort") Case $Exit Exit Case $GUI_EVENT_CLOSE Exit EndSwitch WEndoÝ÷ Øw¥¦+ æ&©¦·«^wú®¢×¢¶Øb²Z(¥j+Þ´gȧ²'^Ö(º±#¥z-ë)¢wm¢·ª¹ë-³bì(®H§Øb²Z(¤Ê/xÞ´g+^±v)í¢Ø^¨§)jwb· +Æ®¶sevÆRæWDvWD7FfP b33cµW&6VçFvRÒæWDvWD'FW5&VB¢òb33c´fÆU6¦P b33cµ6¦TÔ"Òb33c´fÆU6¦Rò#Bò#@ b33cµ7FDÔ"ÒæWDvWD'FW5&VBò#Bò#@ b33cµW&6VçFvTuTÒçBæWDvWD'FW5&VBòb33c´fÆU6¦R£fײgV÷C²RgV÷C° uT7G&Å6WDFFb33cµ&öw&W73Âb33cµW&6VçFvR uT7G&Å6WDFFb33c´Æ&VÃÂb33cµW&6VçFvTuTfײgV÷C²gV÷C²fײçBæWDvWD'FW5&VBó#BfײgV÷C¶´"öbgV÷C²f׶çBb33c´fÆU6¦Ró#BfײgV÷C¶´"gV÷C² 6ÆVW#S¥vVæ My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
Yashied Posted April 30, 2009 Share Posted April 30, 2009 Here's you part of the code of my program. I hope this helps you. expandcollapse popupfunc UpdateDlg($hWnd = 0) const $timeout = 10 * 1000 local $uhgui, $uprogress, $ulbfile, $ulbresult, $uicon, $ucheck, $ubdownload, $ubok, $umsg local $td, $cbyte, $pbyte, $size, $fn = '', $complete = 0, $error = 0, $update = 0 local $updpath = @MyDocumentsDir $uhgui = GUICreate($Lang[13], 380, 261, -1, -1, BitOR($WS_CAPTION, $WS_SYSMENU), -1, $hWnd) GUISetFont(8.5, 400, 0, 'Tahoma', $uhgui) GUICtrlCreateGroup($Lang[14], 11, 10, 358, 208) GUICtrlCreateLabel($Lang[15], 115, 32, 128, 14) GUICtrlCreateLabel($GUI_VERSION, 245, 32, 106, 14) GUICtrlCreateLabel($Lang[16], 115, 54, 128, 14) GUICtrlCreateLabel($ActualVer, 245, 54, 106, 14) _DrawIcon(@ScriptFullPath, 0, 23, 30, 64, 64) $ucheck = GUICtrlCreateCheckbox($Lang[9], 26, 193, 328, 14) GUICtrlSetState(-1, ($GUI_CHECKED * (not $cUpdate)) + ($GUI_UNCHECKED * $cUpdate) + ($GUI_SHOW * ($hWnd = $Form)) + ($GUI_HIDE * (not ($hWnd = $Form)))) $ulbfile = GUICtrlCreateLabel('', 26, 118, 328, 14) GUICtrlSetState(-1, $GUI_HIDE) $uicon = GUICtrlCreateIcon(@ScriptFullPath, -5, 94, 117, 16, 16) GUICtrlSetState(-1, $GUI_HIDE) $ulbresult = GUICtrlCreateLabel('', 115, 118, 210, 14) GUICtrlSetState(-1, $GUI_HIDE) $uprogress = GUICtrlCreateProgress(26, 135, 328, 14) GUICtrlSetState(-1, $GUI_HIDE) $ubdownload = GUICtrlCreateButton($Lang[17], 140, 158, 100, 23) $ubok = GUICtrlCreateButton('OK', 295, 228, 75, 23) GUICtrlSetState(-1, BitOR($GUI_DEFBUTTON, $GUI_FOCUS)) GUISetState(@SW_SHOW, $uhgui) while 1 if $update then if (@InetGetActive) and (not $error) then $cbyte = @InetGetBytesRead if $cbyte < 0 then $error = 1 else if $cbyte > $pbyte then $pbyte = $cbyte $td = TimerInit() else if TimerDiff($td) > $timeout then $error = 1 endif endif endif Sleep(10) else $cbyte = @InetGetBytesRead if $cbyte < 0 then $error = 1 else $complete = 1 endif endif if (not $error) and (not $complete) then GUICtrlSetData($uprogress, $cbyte / $size * 100) endif endif if ($error) or ($complete) then InetGet('abort') GUICtrlSetState($ubok, $GUI_ENABLE) GUICtrlSetState($uprogress, $GUI_HIDE) GUICtrlSetState($ulbfile, $GUI_HIDE) if $error then GUICtrlSetState($uicon, $GUI_SHOW) GUICtrlSetData($ulbresult, $Lang[18]) GUICtrlSetState($uicon, $GUI_SHOW) FileDelete($fn) else GUICtrlSetState($ubdownload, $GUI_DISABLE) GUICtrlSetData($ulbresult, $Lang[19]) endif GUICtrlSetState($ulbresult, $GUI_SHOW) GUICtrlSetData($uprogress, 0) GUICtrlSetData($ulbfile, '') GUICtrlSetData($ubdownload, $Lang[17]) $fn = '' $update = 0 $complete = 0 $error = 0 endif $umsg = GUIGetMsg() select case ($umsg = $ubok) or ($umsg = $GUI_EVENT_CLOSE) if $update then if MsgBox(48 + 4, $Lang[13], $Lang[20] & @CR & @CR & $Lang[22], 0, $uhgui) = 6 then InetGet('abort') FileDelete($fn) exitloop endif else exitloop endif case ($umsg = $ubdownload) if $update then InetGet('abort') FileDelete($fn) $fn = '' GUICtrlSetState($ubok, $GUI_ENABLE) GUICtrlSetState($uprogress, $GUI_HIDE) GUICtrlSetState($ulbfile, $GUI_HIDE) GUICtrlSetData($uprogress, 0) GUICtrlSetData($ulbfile, '') GUICtrlSetData($ubdownload, $Lang[17]) $update = 0 else $fn = FileSaveDialog($Lang[10], $updpath, $Lang[12], 1 + 2, StringTrimLeft($fUpdate, StringInStr($fUpdate, '/', 0, -1)), $uhgui) if StringLen($fn) > 0 then $updpath = StringMid($fn, 1, StringInStr($fn, '\', 0, -1) - 1) GUICtrlSetState($uicon, $GUI_HIDE) GUICtrlSetState($ulbresult, $GUI_HIDE) GUICtrlSetState($ubok, $GUI_DISABLE) GUICtrlSetState($uprogress, $GUI_SHOW) GUICtrlSetState($ulbfile, $GUI_SHOW) GUICtrlSetData($ulbresult, '') GUICtrlSetData($ulbfile, _StringCut($uhgui, $ulbfile, $fn, 328)) GUICtrlSetData($ubdownload, $Lang[21]) $update = 1 $complete = 0 $cbyte = 0 $pbyte = 0 $size = InetGetSize($fUpdate) if (@error) or ($size = 0) then $error = 1 else $error = 0 InetGet($fUpdate, $fn, 1, 1) $td = TimerInit() endif endif endif case ($umsg = $ucheck) $cUpdate = not $cUpdate endselect wend _WinAPI_SetActiveWindow($hWnd) GUIDelete($uhgui) endfunc; UpdateDlg My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... 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