madasraka Posted March 25, 2010 Share Posted March 25, 2010 i made this script for my self to download file from my website/extract it and replace original EXE with newly extracted. Its an updater, not a part of code. This has to be compiled separately. expandcollapse popup#include <ProgressConstants.au3> $FileToUpdate = "my program.exe" $FileToDownload = "compressed.rar" $FileDownloadURL = "http://www.mywebsite.com" $FileToReplace = (@ScriptDir & "\" & $FileToUpdate) $Decompressor = "UnRAR.exe" $DecompressCommand = ($Decompressor & " x -o+ " & $FileToDownload) Updater() Func Updater() FileRecycle (@ScriptDir & "\" & $FileToDownload) ProcessWaitClose ($FileToUpdate) ;Wait for process to close before file will be available for replacement $FileSize = InetGetSize ($FileDownloadURL & $FileToDownload,1) $FileDownloading = InetGet ($FileDownloadURL & $FileToDownload, @ScriptDir & "\" & $FileToDownload,1,1) ;1 for Force redownload, 1 for Do not wait till downloaded and go next ProgressOn ("Download progress", "Downloading file ", "0 %") ;start progress bar windows For $i = 1 to $FileSize step 1 $FileDownloadingInfo = InetGetInfo ($FileDownloading) $FilePercentDownloaded = Round($FileDownloadingInfo[0]*100/$FileSize, 2) ProgressSet($FilePercentDownloaded, $FilePercentDownloaded & " %") ;GUICtrlSetData ($progress,$percentDownloaded) If InetGetInfo($FileDownloading,2) Then InetClose($FileDownloading) ExitLoop Else ContinueLoop EndIf Next ProgressOff() ProgressSet(100 , "100%", "Download completed.") RunWait ($DecompressCommand) FileMove (@ScriptDir & "\" & $FileToUpdate,@ScriptDir & "\" & $FileToUpdate,1) MsgBox(0,'','') FileRecycle (@ScriptDir & "\" & $FileToDownload) ;erase downloaded file MsgBox(0,'Information','Update Complete !') EndFunc Link to comment Share on other sites More sharing options...
tymo93 Posted February 25, 2012 Share Posted February 25, 2012 It does not Work For me... can you update please? Link to comment Share on other sites More sharing options...
martin Posted February 26, 2012 Share Posted February 26, 2012 tymo, the first post was made nearly 2 years ago and, as you should be able to see, madasraka has not posted in these forums for about a year. Since there are a lot of settings that you have to make to suit what you want to do it would have been sensible to at least have given detailed information about exactly what failed, error messages and so on. In any case, since the script is very simple and short, you should be able to either sort out the problem yourself or by asking for help (with plenty of relevant information) in general help. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. 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