kjpolker Posted July 5, 2023 Share Posted July 5, 2023 I am attempting to fetch a download and wait until the download is complete but I never get past it downloading and I am not seeing much relating to this as it doesn't seem to ever be an issue. Func versionCheck() $getVersion = InetGet("URL/File", @TempDir & "\File", 1) Do ConsoleWrite($getVersion) & @CRLF) ;trying to troubleshoot Sleep(2000) Until InetGetInfo($getVersion, 2) ;This is never satisfied and just locks up the program InetClose($getVersion) MsgBox(0, "", "Complete") EndFunc I can see the file is successfully downloaded to the temp directory and I can open it. What's the deal? Link to comment Share on other sites More sharing options...
Danp2 Posted July 5, 2023 Share Posted July 5, 2023 This could be due to an issue with security on the site being accessed. Can you post a version that we can actually run to reproduce the issue? Also, what version of AutoIt and Windows are you running? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
kjpolker Posted July 6, 2023 Author Share Posted July 6, 2023 (edited) 23 minutes ago, Danp2 said: This could be due to an issue with security on the site being accessed. Can you post a version that we can actually run to reproduce the issue? Also, what version of AutoIt and Windows are you running? Try this, just tested and can see the file get downloaded into temp directory. I kept the file structure similar for testing (.version) but it's just the au3 file itself. #include <MsgBoxConstants.au3> #include <InetConstants.au3> versionCheck() Func versionCheck() ShellExecute(@TempDir) $getVersion = InetGet("https://filebin.net/dtl7wvzrdd63wmfl/versiontest.au3", @TempDir & "\File.version") Do Until InetGetInfo($getVersion, 2) ;This is never satisfied and just locks up the program InetClose($getVersion) MsgBox(0, "", "Complete") EndFunc I am running Windows 10 and using AutoIt 3.3.14.5 EDIT: I just updated to 3.3.16.1 Edited July 6, 2023 by kjpolker Link to comment Share on other sites More sharing options...
Solution Andreik Posted July 6, 2023 Solution Share Posted July 6, 2023 (edited) #include <MsgBoxConstants.au3> #include <InetConstants.au3> versionCheck() Func versionCheck() ShellExecute(@TempDir) $getVersion = InetGet("https://filebin.net/dtl7wvzrdd63wmfl/versiontest.au3", @TempDir & "\File.version", 1, 1) Do Sleep(10) Until InetGetInfo($getVersion, 2) ;This is never satisfied and just locks up the program InetClose($getVersion) MsgBox(0, "", FileRead(@TempDir & "\File.version")) EndFunc or #include <MsgBoxConstants.au3> #include <InetConstants.au3> versionCheck() Func versionCheck() ShellExecute(@TempDir) InetGet("https://filebin.net/dtl7wvzrdd63wmfl/versiontest.au3", @TempDir & "\File.version", 1, 0) MsgBox(0, "", FileRead(@TempDir & "\File.version")) EndFunc Edited July 6, 2023 by Andreik Link to comment Share on other sites More sharing options...
kjpolker Posted July 6, 2023 Author Share Posted July 6, 2023 @Andreik So is there an issue with the options? Force reloading source? Link to comment Share on other sites More sharing options...
Andreik Posted July 6, 2023 Share Posted July 6, 2023 (edited) There is no issue, InetGet() works in 2 different ways. If you specify INET_DOWNLOADBACKGROUND then function return a handle that can be used with InetGetInfo() to get more info about the download process. If you use INET_DOWNLOADWAIT (default mode) the function wait until the download is done and return the number of bytes downloaded. In your case default mode was implicit but you expected to use InetGetInfo() and this doesn't work. I used INET_FORCERELOAD just to be sure I don't get anything from cache. Edited July 6, 2023 by Andreik kjpolker 1 Link to comment Share on other sites More sharing options...
kjpolker Posted July 6, 2023 Author Share Posted July 6, 2023 (edited) @Andreik Ahhh, I feel like a dummy. Thank you for clarifying! Can I still use @error to capture an incomplete or Windows defender issue of removing the file? Is there a built in timeout for a return of 0? Edited July 6, 2023 by kjpolker Link to comment Share on other sites More sharing options...
Andreik Posted July 6, 2023 Share Posted July 6, 2023 It depends. If you have a handle returned by InetGet() then use InetGetInfo() with index INET_DOWNLOADERROR, otherwise use @error. It's all in help file, just read it. 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