#RequireAdmin ; подстраховка чтобы на win7 все стопроцентно сработало
Global $version = 1, $version_
Global $Web = "http://website.ru/Programs/Name/"
_CheckUpdate()
Func _CheckUpdate()
Local $x, $Answer
$x = InetGet ($Web & "update.ini", "update.ini")
If $x = 0 Then
MsgBox(16, "Error", "Server is not found")
Else
$version_ = IniRead("update.ini", "Settings", "Version", "error")
If ($version <> $version_) Then
$Answer = MsgBox(36, "Info", "New version is avabile. Do you want to download it?")
If $Answer = 6 Then _Update()
Else
FileDelete ("update.ini")
MsgBox(64, "Info", "You are using the latest version! :)")
EndIf
EndIf
EndFunc
Func _Update()
;~ IniWrite ("update.ini", "Settings", "Version", "0.4")
;~ IniWrite ("update.ini", "Settings", "Size", "473kb")
;~ IniWrite ("update.ini", "Settings", "Date", "12/06/09")
Local $size, $date, $x
$size = IniRead("update.ini", "Settings", "Size", "error")
$date = IniRead("update.ini", "Settings", "Date", "error")
FileDelete ("update.ini")
MsgBox(64, "Info", "Information about new version:" & @CRLF & @CRLF & "Version: " & @TAB & $version_ & @CRLF & "Size: " & @TAB & $size & @CRLF & "Date: " & @TAB & $date )
$x = InetGet($Web & "uploader.exe", @TempDir & "\" & "ProrgamName Uploader.exe")
If $x = 0 Then
MsgBox(16, "Error", "File is not found")
Else
MsgBox(64, "Info", "File downloaded succsessfully. Starting update")
Run(@TempDir & "\" & "ProrgamName Uploader.exe")
Exit
EndIf
EndFunc