abdulrahmanok Posted October 18, 2016 Share Posted October 18, 2016 (edited) Hi Brothers , Firstly Thank you all for helping me to learn Autoit Great language I learned alot from your examples . Today I want to make Func searching for update from internet like this : Check Raw called "Version" Download Raw Called "Lastest Download link" Example : $check = Read Raw from this link "https://raw.githubusercontent.com/abdulrahmanok/Version/master/version" $download = Download file from this link"https://raw.githubusercontent.com/abdulrahmanok/Version/master/LatestVersionLink" and Copy download files To @scriptindir I found Old posts tries to update but its very complicated. Solved : Thanks To @Muhammad_Awais_Sharif Edited October 18, 2016 by abdulrahmanok Link to comment Share on other sites More sharing options...
Muhammad_Awais_Sharif Posted October 18, 2016 Share Posted October 18, 2016 (edited) #include <Inet.au3> #include <InetConstants.au3> MsgBox(0,"version",_INetGetSource('https://raw.githubusercontent.com/abdulrahmanok/Version/master/version')) Local $link = _INetGetSource('https://raw.githubusercontent.com/abdulrahmanok/Version/master/LatestVersionLink') Local $hDownload = InetGet($link,"d:\filename",Default,$INET_DOWNLOADBACKGROUND) ; Wait for the download to complete by monitoring when the 2nd index value of InetGetInfo returns True. Do Sleep(250) Until InetGetInfo($hDownload, $INET_DOWNLOADCOMPLETE) Edited October 18, 2016 by Muhammad_Awais_Sharif correct code :P Link to comment Share on other sites More sharing options...
abdulrahmanok Posted October 18, 2016 Author Share Posted October 18, 2016 Just now, Muhammad_Awais_Sharif said: #include <Inet.au3> #include <InetConstants.au3> MsgBox(0,"version",_INetGetSource('https://raw.githubusercontent.com/abdulrahmanok/Version/master/version')) Local $link _INetGetSource('https://raw.githubusercontent.com/abdulrahmanok/Version/master/LatestVersionLink') Local $hDownload = InetGet($link,"c:\filename",Default,$INET_DOWNLOADBACKGROUND) ; Wait for the download to complete by monitoring when the 2nd index value of InetGetInfo returns True. Do Sleep(250) Until InetGetInfo($hDownload, $INET_DOWNLOADCOMPLETE) Ty For Fast response I will Try it now Link to comment Share on other sites More sharing options...
abdulrahmanok Posted October 18, 2016 Author Share Posted October 18, 2016 2 minutes ago, Muhammad_Awais_Sharif said: #include <Inet.au3> #include <InetConstants.au3> MsgBox(0,"version",_INetGetSource('https://raw.githubusercontent.com/abdulrahmanok/Version/master/version')) Local $link _INetGetSource('https://raw.githubusercontent.com/abdulrahmanok/Version/master/LatestVersionLink') Local $hDownload = InetGet($link,"c:\filename",Default,$INET_DOWNLOADBACKGROUND) ; Wait for the download to complete by monitoring when the 2nd index value of InetGetInfo returns True. Do Sleep(250) Until InetGetInfo($hDownload, $INET_DOWNLOADCOMPLETE) No variable given for "Dim", "Local", "Global", "Struct" or "Const" statement.: Local $link _INetGetSource('https://raw.githubusercontent.com/abdulrahmanok/Version/master/LatestVersionLink') Local $link ^ ERROR Link to comment Share on other sites More sharing options...
Muhammad_Awais_Sharif Posted October 18, 2016 Share Posted October 18, 2016 #include <Inet.au3> #include <InetConstants.au3> MsgBox(0,"version",_INetGetSource('https://raw.githubusercontent.com/abdulrahmanok/Version/master/version')) Local $link = _INetGetSource('https://raw.githubusercontent.com/abdulrahmanok/Version/master/LatestVersionLink') Local $hDownload = InetGet($link,"d:\filename",Default,$INET_DOWNLOADBACKGROUND) ; Wait for the download to complete by monitoring when the 2nd index value of InetGetInfo returns True. Do $ArrayOFDownloadStatuts = InetGetInfo($hDownload) ConsoleWrite("currently downloaded " & Round($ArrayOFDownloadStatuts[0] / 2 ^ 10) & " KB" & @CRLF) ConsoleWrite("Total Size " & Round($ArrayOFDownloadStatuts[1] / 2 ^ 20, 2) & " MB" & @CRLF) Sleep(250) Until InetGetInfo($hDownload, $INET_DOWNLOADCOMPLETE) posted after testing Link to comment Share on other sites More sharing options...
abdulrahmanok Posted October 18, 2016 Author Share Posted October 18, 2016 18 minutes ago, Muhammad_Awais_Sharif said: #include <Inet.au3> #include <InetConstants.au3> MsgBox(0,"version",_INetGetSource('https://raw.githubusercontent.com/abdulrahmanok/Version/master/version')) Local $link = _INetGetSource('https://raw.githubusercontent.com/abdulrahmanok/Version/master/LatestVersionLink') Local $hDownload = InetGet($link,"d:\filename",Default,$INET_DOWNLOADBACKGROUND) ; Wait for the download to complete by monitoring when the 2nd index value of InetGetInfo returns True. Do $ArrayOFDownloadStatuts = InetGetInfo($hDownload) ConsoleWrite("currently downloaded " & Round($ArrayOFDownloadStatuts[0] / 2 ^ 10) & " KB" & @CRLF) ConsoleWrite("Total Size " & Round($ArrayOFDownloadStatuts[1] / 2 ^ 20, 2) & " MB" & @CRLF) Sleep(250) Until InetGetInfo($hDownload, $INET_DOWNLOADCOMPLETE) posted after testing Ty its working but look at full code : #include <Inet.au3> #include <InetConstants.au3> #include <File.au3> $updatecheck=_INetGetSource('https://raw.githubusercontent.com/abdulrahmanok/Version/master/version') $opennew = @ScriptDir & "/version.txt" Local $readOne = FileReadLine($opennew, 1) if $readOne = $updatecheck Then MsgBox(0,"Thank You" , " You Already Have lastest Update ") Else MsgBox(0,"OOPS" , "There IS Newer Version Avalible Please wait Until Downlad Finished") checkupdate() EndIf func checkupdate() MsgBox(0,"version",_INetGetSource('https://raw.githubusercontent.com/abdulrahmanok/Version/master/version')) Local $link = _INetGetSource('https://raw.githubusercontent.com/abdulrahmanok/Version/master/LatestVersionLink') Local $hDownload = InetGet($link,"d:\filename.exe",Default,$INET_DOWNLOADBACKGROUND) ; Wait for the download to complete by monitoring when the 2nd index value of InetGetInfo returns True. Do $ArrayOFDownloadStatuts = InetGetInfo($hDownload) ConsoleWrite("currently downloaded " & Round($ArrayOFDownloadStatuts[0] / 2 ^ 10) & " KB" & @CRLF) ConsoleWrite("Total Size " & Round($ArrayOFDownloadStatuts[1] / 2 ^ 20, 2) & " MB" & @CRLF) Run("filename.exe","d:\") Sleep(250) Until InetGetInfo($hDownload, $INET_DOWNLOADCOMPLETE) EndFunc version.txt date is = 2.0 1- why Check doesn't work ? 2- Why it doesn't run file after download it ? Link to comment Share on other sites More sharing options...
Muhammad_Awais_Sharif Posted October 18, 2016 Share Posted October 18, 2016 what do you mean check does not work ? i think if you are asking about function then if $readOne = $updatecheck Then may be because version are both same 2-because you are not giving right path Run("d:\filename.exe") Link to comment Share on other sites More sharing options...
abdulrahmanok Posted October 18, 2016 Author Share Posted October 18, 2016 (edited) 3 minutes ago, Muhammad_Awais_Sharif said: what do you mean check does not work ? i think if you are asking about function then I mean Both Values are "2.0" so it must show : MsgBox(0,"Thank You" , " You Already Have lastest Update ") but it doesn't do this it still show that there is another newer update ... And " Run" Is working now thanks Edited October 18, 2016 by abdulrahmanok Link to comment Share on other sites More sharing options...
abdulrahmanok Posted October 18, 2016 Author Share Posted October 18, 2016 (edited) 11 minutes ago, Muhammad_Awais_Sharif said: what do you mean check does not work ? i think if you are asking about function then if $readOne = $updatecheck Then may be because version are both same 2-because you are not giving right path Run("d:\filename.exe") Thank You very much I Solved This By Another Trick : #include <Inet.au3> #include <InetConstants.au3> $asd=2.0 $updatecheck=_INetGetSource('https://raw.githubusercontent.com/abdulrahmanok/Version/master/version') if $updatecheck <= $asd Then MsgBox(0,"Thank You" , " You Already Have lastest Update ") Else MsgBox(0,"New IS COMING" , "There IS Newer Version Avalible Please wait Until Downlad Finished") checkupdate() EndIf func checkupdate() MsgBox(0,"version",_INetGetSource('https://raw.githubusercontent.com/abdulrahmanok/Version/master/version')) Local $link = _INetGetSource('https://raw.githubusercontent.com/abdulrahmanok/Version/master/LatestVersionLink') Local $hDownload = InetGet($link,"d:\filename.exe",Default,$INET_DOWNLOADBACKGROUND) ; Wait for the download to complete by monitoring when the 2nd index value of InetGetInfo returns True. Do $ArrayOFDownloadStatuts = InetGetInfo($hDownload) ConsoleWrite("currently downloaded " & Round($ArrayOFDownloadStatuts[0] / 2 ^ 10) & " KB" & @CRLF) ConsoleWrite("Total Size " & Round($ArrayOFDownloadStatuts[1] / 2 ^ 20, 2) & " MB" & @CRLF) Run("d:\filename.exe") Sleep(250) Until InetGetInfo($hDownload, $INET_DOWNLOADCOMPLETE) EndFunc Now I Don't even need To "txt" File Edited October 18, 2016 by abdulrahmanok Link to comment Share on other sites More sharing options...
Muhammad_Awais_Sharif Posted October 18, 2016 Share Posted October 18, 2016 you are comparing 2.8 with 2.0 update version from this link is 2.8 $updatecheck=_INetGetSource('https://raw.githubusercontent.com/abdulrahmanok/Version/master/version') Link to comment Share on other sites More sharing options...
abdulrahmanok Posted October 18, 2016 Author Share Posted October 18, 2016 Just now, Muhammad_Awais_Sharif said: you are comparing 2.8 with 2.0 update version from this link is 2.8 $updatecheck=_INetGetSource('https://raw.githubusercontent.com/abdulrahmanok/Version/master/version') Yes sir I'm Still Changing "version" Value To test it . Muhammad_Awais_Sharif 1 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