abdulrahmanok

Update and run program Func

11 posts in this topic

#1 ·  Posted (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 by abdulrahmanok

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 by Muhammad_Awais_Sharif
correct code :P

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
#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 :D:P 

Share this post


Link to post
Share on other sites
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 :D:P 

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 ?

Share this post


Link to post
Share on other sites

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")

 

Share this post


Link to post
Share on other sites

#8 ·  Posted (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 by abdulrahmanok

Share this post


Link to post
Share on other sites

#9 ·  Posted (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 by abdulrahmanok

Share this post


Link to post
Share on other sites

#10 ·  Posted

you are comparing 2.8 with 2.0 :P 

update version from this link is 2.8 

$updatecheck=_INetGetSource('https://raw.githubusercontent.com/abdulrahmanok/Version/master/version')

Share this post


Link to post
Share on other sites

#11 ·  Posted

Just now, Muhammad_Awais_Sharif said:

you are comparing 2.8 with 2.0 :P 

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 .

1 person likes this

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now