highend Posted February 27, 2012 Share Posted February 27, 2012 Hi, I'm trying to get a slightly modified version of a Google Chrome updater script to work. expandcollapse popup; Download with progress update $window = GUICreate("Chrome Download", 306, 40) $progressbar = GUICtrlCreateProgress(9, 15, 286, 17) GUISetState(@SW_SHOW) ; Get filesize $filesize = InetGetSize($update_url) ; Get latest chrome.exe file $hdownload = InetGet($update_url, @ScriptDir & "\Update\chrome_aktuell.exe", 1, 1) Do $percent = Round(((InetGetInfo($hdownload, 0) / $filesize) * 100)) & "%" GUICtrlSetData($progressbar, $percent) $msg = GUIGetMsg() ; If progress window gets closed, abort download and clean up If $msg = $GUI_EVENT_CLOSE Then InetClose($hdownload) DirRemove(@ScriptDir & "\Update", 1) Exit EndIf Sleep(250) Until InetGetInfo($hdownload, 2) ; Check for finished download InetClose($hdownload) GUIDelete() ; Download done, close progress window ; Sleep(5000) ; Extract 7za.exe (will be included in the compiled .exe) FileInstall("7za.exe", @ScriptDir & "\") ; Extract Chrome setup file RunWait('7za.exe x "' & @ScriptDir & '\Update\chrome_aktuell.exe" -o"' & @ScriptDir & '\Update"') ; Extract Chrome contents RunWait('7za.exe x "' & @ScriptDir & '\Update\chrome.7z" -o"' & @ScriptDir & '\Update\extracted"') Ofc it's only a part of the full script but it includes the necessary parts for the actual problem. At least I hope so. The whole script works flawlessly on my computer and in all virtual machines (VMware, XP SP3, Vista, Win 7 de / en x86/64) with a "normal" inet connection speed (16MBit downstream). But it doesn't work correctly on a few other physical systems (all of them are Win 7 x86/64 ones). All of them have 6 MBit connection at max. E.g. I can let it run on the notebook of my girlfriend and it won't even show the 7za dos windows that should extract the necessary files as long as I don't uncomment the Sleep(5000) command. If I do that it's working correctly... (at least on three tries, where it failed three times before without the Sleep command). I just don't understand why it needs a pause before the rest of the script will do it's job. Does anyone see a reason why the script can fail when no Sleep command is used? Tia, Highend Link to comment Share on other sites More sharing options...
DW1 Posted February 27, 2012 Share Posted February 27, 2012 (edited) I'm not sure about this, but perhaps the file has not actually completed moving to the download location? Maybe try creating a small loop that waits until the downloaded file exists in the expected location before your RunWait()'s While Not FileExists(@ScriptDir & "Updatechrome_aktuell.exe") Sleep(10) WEnd I may be way off here, but try that instead of the sleep? Edited February 27, 2012 by danwilli AutoIt3 Online Help Link to comment Share on other sites More sharing options...
highend Posted February 28, 2012 Author Share Posted February 28, 2012 I'm afraid that a FileExists while loop test won't help. InetGet($update_url, @ScriptDir & "Updatechrome_aktuell.exe", 1, 1 This will download the chrome_aktuell.exe file directly into the @ScriptDir & "Update" folder. No temp files, no file moving or anything else. I can see the destination file in the moment the download has started, growing "byte by byte" (at least if I hit F5 in the file manager). 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