4got Posted April 3, 2015 Share Posted April 3, 2015 Hello everybody, it's been a long time since I wrote here last time, But I was focused on other projects Now I've just started to code with autoit again, and need the help of the forum: I have an url that points to a file that I need to download, and in this case the function InetGet is what I need, so this is the code: InetGet("http://download.piriform.com/ccsetup504.exe", @HomeDrive & @HomePath & "\setup\CCleaner.exe",0,1) InetGet("http://donate.libreoffice.org/home/dl/win-x86/4.4.1/en/LibreOffice_4.4.1_Win_x86.msi", @HomeDrive & @HomePath & "\setup\LibreOffice.msi",0,1) In the first case, the program is downloaded ,but during the installation process, the installer unexpectedly closes; I think the installer is not entirely downloaded, because if I paste the same url in a browser the program is correctly downloaded. In the second case the installer is downloaded, but it won't even starts, showing me an error. What is wrong with this??? Link to comment Share on other sites More sharing options...
Developers Jos Posted April 3, 2015 Developers Share Posted April 3, 2015 (edited) Did you compare the size of the manual downloaded files? PS. Your are downloading in the background so I hope you added logic to check whether it is finished or not to your script. Jos Edited April 3, 2015 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
4got Posted April 3, 2015 Author Share Posted April 3, 2015 (edited) The size is the same for both the two files (CCleaner) but for Libreoffice the script downloads only a 32 KB file , and to check the download status I use InetGetInfo($DownStatus, 2) Edited April 3, 2015 by 4got Link to comment Share on other sites More sharing options...
Developers Jos Posted April 3, 2015 Developers Share Posted April 3, 2015 Show your actual code that has the statements starting the download and checking for its completion. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
4got Posted April 4, 2015 Author Share Posted April 4, 2015 This is the section of code for the download: Local $DownStatus = InetGet("http://download.piriform.com/ccsetup504.exe", @HomeDrive & @HomePath & "\setup\CCleaner.exe",0,1) ProgressOn("Downloading", "CCleaner", "In progress") Do $PercDown = CalcDown(InetGetInfo($DownStatus, 1), InetGetInfo($DownStatus, 0)) ProgressSet($PercDown) Sleep(250) Until (InetGetInfo($DownStatus, 2)) ProgressOff(); There is a progress bar to see the download % , and CalcDown is a function that calculates the among of bytes downloaded , in order to update it. Func CalcDown($total, $current) If $total <> 0 Then Local $MB = (($current * 100) / $total) Return Round($MB, 0) Else Return 0 EndIf EndFunc Link to comment Share on other sites More sharing options...
Developers Jos Posted April 4, 2015 Developers Share Posted April 4, 2015 Looks good and this is the one that had the same size. Did you do a compare of the 2 files to see whether they are binary equal? WinMerge could do that for example. It should work when that is the case. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
4got Posted April 4, 2015 Author Share Posted April 4, 2015 (edited) I'll check with WinMerge, but what about libreoffice? The code is the same but in this case only a small file is downloaded ,that's not Libreoffice. ***EDIT*** Maybe I catch the problem: when you open the link to Libreoffice , a web page is displayed ,and then the download starts, so MAYBE the inetget downloads the html and not the file. Am I wrong? Edited April 4, 2015 by 4got Link to comment Share on other sites More sharing options...
Developers Jos Posted April 4, 2015 Developers Share Posted April 4, 2015 (edited) I'll check with WinMerge, but what about libreoffice? The code is the same but in this case only a small file is downloaded ,that's not Libreoffice. Have you looked at the actual content of the downloaded file? You will see it is an HTML file that contains a redirect for the actual installer: <meta http-equiv="Refresh" content="0; url=http://download.documentfoundation.org/libreoffice/stable/4.4.1/win/x86/LibreOffice_4.4.1_Win_x86.msi"/> So just change your Inetget to: InetGet("http://download.documentfoundation.org/libreoffice/stable/4.4.1/win/x86/LibreOffice_4.4.1_Win_x86.msi", "c:\temp\LibreOffice.msi") Jos Edited April 4, 2015 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
4got Posted April 8, 2015 Author Share Posted April 8, 2015 (edited) Checked the two version of CCleaner with WinMerge , it's the same file..........So I think it's not an autoit's problem....... **EDIT** Found the problem: I don't have to change the name of the downloaded file, because the installer probably crashes when tries to extract files from the .exe Edited April 9, 2015 by 4got 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