Ultracasual Posted January 10, 2013 Share Posted January 10, 2013 (edited) Ahoy! I'm having troubles with InetGet(). I'm writing a small program to download files from the net into a specific directory. The method I'm using is as follows: I load a list of files into the .ini stored on my server and then the program splits the list into an array and downloads them into a directory. I think it's straight forward and I love the low resources / cloud capability. However, with my current method downloads > 5mb tend to hang up causing the GUI to report 'not responding' ;( This is running InetGet in its default state (non background). My questions are: 1) Keeping the .ini style array generation, is there a better technique to download my files in a more reliable manner? Global $URL = "http://***.net/download_files/";<= main directory on server Global $dir = @DestopDir & '/download_files';<= main directory on computer Global $netData = StringSplit(_INetGetSource($URL & 'filelist.ini'), "[^]", 1);<= ini file splitting into an array If @error Then;<= makes sure the program downloaded the .ini properly <3 MsgBox(048, 'Unable To Connect', 'Cannot connect to server: unable to retrieve data!') Exit EndIf For $i = 8 To $netData[0];<= standard 'for' statement to begin breaking down the array at the correct location of files getFiles('folder-1', $netData[$i]) Next Func getFiles($location, $file);<= this called to download the file, the GUI* can be ignored GUICtrlSetData($Progress, '..' & $file) GUICtrlSetBkColor($Progress, 0xC67171) InetGet($URL & $location & $file, $dir & $location & $file, 1, 0) Sleep(1000) GUICtrlSetBkColor($Progress, 0xFFFBF0) EndFunc ;==>getFiles Edited January 10, 2013 by Ultracasual Link to comment Share on other sites More sharing options...
kylomas Posted January 10, 2013 Share Posted January 10, 2013 Ultracasual, However, with my current method downloads > 5mb tend to hang up causing the GUI to report 'not responding' ;( This is running InetGet in its default state (non background).Does the download keep running?kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
Ultracasual Posted January 10, 2013 Author Share Posted January 10, 2013 Ultracasual,Does the download keep running?kylomasYes it does continue and eventually regains function but it takes a while - much longer than it should. It's almost like the download timeout scheme is somehow integrating into the entire script. It gives me an idea... I'll fiddle around with this a bit more and post info. It involves running Inetget() in background mode and then checking the status until completion then starting the next download in the same way. Link to comment Share on other sites More sharing options...
kylomas Posted January 10, 2013 Share Posted January 10, 2013 (edited) Ultracasual,Yes, that was the point of the question. Change to background mode and you can have multiple concurrent downloads and your gui should remain responsive.There are some excellent examples on the forum, just search for them.kylomasedit: additional infoIt's almost like the download timeout scheme is somehow integrating into the entire script.There are too many variables here to assume that, including remote site and connection performance. Edited January 10, 2013 by kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
Ultracasual Posted January 10, 2013 Author Share Posted January 10, 2013 (edited) Ultracasual, Yes, that was the point of the question. Change to background mode and you can have multiple concurrent downloads and your gui should remain responsive. There are some excellent examples on the forum, just search for them. kylomas Ok so it turns out this worked. Just had to add 2 (edit: a few ><) lines of code: Func getFiles($location, $file) GUICtrlSetData($Progress, '..' & $file) GUICtrlSetBkColor($Progress, 0xC67171) $download = InetGet($URL & $location & $file, $mcd & $location & $file, 1, 1) Do Sleep(500) Until InetGetInfo($download, 2) Sleep(400) InetClose($download) GUICtrlSetBkColor($Progress, 0xFFFBF0) EndFunc ;==>getFiles Thanks for the assistance _ Edited January 10, 2013 by Ultracasual Link to comment Share on other sites More sharing options...
kylomas Posted January 10, 2013 Share Posted January 10, 2013 My pleasure... Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
guinness Posted January 10, 2013 Share Posted January 10, 2013 You can also do this in a separate process. Search _InetGetOutOfProcess by guinness. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
kylomas Posted January 10, 2013 Share Posted January 10, 2013 @guinness - a perfect example of K.I.S.S. Why "runwait" instead of "run"? kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
guinness Posted January 10, 2013 Share Posted January 10, 2013 (edited) @guinness - a perfect example of K.I.S.S. Why "runwait" instead of "run"?kylomasI created it a while ago so perhaps it could be improved upon, but it shouldn't create a "non responding" in the GUI. Edited January 10, 2013 by guinness UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
kylomas Posted January 10, 2013 Share Posted January 10, 2013 Thanks, just curious. Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill 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