Jump to content

Recommended Posts

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 by Ultracasual
Link to comment
Share on other sites

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

Ultracasual,

Does the download keep running?

kylomas

Yes 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

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

edit: additional info

It'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 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

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 by Ultracasual
Link to comment
Share on other sites

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 parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

@guinness - a perfect example of K.I.S.S. Why "runwait" instead of "run"?

kylomas

I created it a while ago so perhaps it could be improved upon, but it shouldn't create a "non responding" in the GUI. Edited 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 parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...