Auto UpdateIt!
Nach dem netten support von th.meger , ist es vollbracht(!)
Das Script prüft alle 5 Stunden, ob ein neue AutoIt version existiert.
Wenn ja, automatisch runterladen im Hintergrund und unattended installieren!
Wenn nein, tut es:
nix :schild4:
Es prüft alle 5 Stunden nochmal, um nicht Download volumen zu verschwenden!
die liste der aktuellen Autoit - Versionen wird dafür heruntergeladen, in den TEMP ordner. beim nächsten check wird sie dann erneuert und wieder verglichen!
Sobald mir jemand erklärt wie es geht, bau ich noch einen Autostart dazu.
Tray Icon kann sich jeder nehmen oder weggeben, dafür einfach
#NoTrayIcon
am anfang des scriptes..
zu credits:
th.meger für bug found :schild4:
und ich hab mir von schneemann (WinKlipper) den Tray bisschen abgeguckt - deswegen wird er hier verewigt
Wer mir erklärt wie ich Autostart mache, bin ich dankbar
f7: exit, f6: about^^
Spoiler anzeigen
; Auto UpdateIt by Huggy
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]#include <GuiConstants.au3>
#include <Constants.au3>
HotKeySet("{F6}", "_check")
HotKeySet("{F7}", "_exit")
; Globals setzen
; _-------------------------------------------------------------------------------------------------------------------------
Global $autoit = RegRead('HKLM\Software\AutoIt v3\AutoIt', 'InstallDir')
Global $url = "http://www.autoitscript.com/autoit3/files/beta/update.dat"
Global $local = @TempDir & '\au3_update.dat'
global $autostartkey = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run"
Global $s_BetaPath = RegRead('HKLM\Software\AutoIt v3\AutoIt', 'betaInstallDir')
If Not @error And FileExists($s_BetaPath & '\AutoIt3.exe') Then
$version2local = FileGetVersion($s_BetaPath & "\AutoIt3.exe")
EndIf
Global $s_Au3Path = RegRead('HKLM\Software\AutoIt v3\AutoIt', 'InstallDir')
If Not @error And FileExists($s_Au3Path & '\AutoIt3.exe') Then
$version1local = FileGetVersion($s_Au3Path & "\AutoIt3.exe")
EndIf
Global $a = "10000000000000000"
[/autoit] [autoit][/autoit] [autoit]; Globals ende
; --------------------------------------------------------------------------------------------------------------------------------
;--------------------------------------------------------------------------------------------------------------------------------------
; start
_check()
[/autoit] [autoit][/autoit] [autoit]; endstart
; ---------------------------------------------------------------------------------------------------------------------------------------
; Functionen
;---------------------------------------------------------------------------------------------------------------------------------------
Func _check()
If FileExists(@TempDir & "\update.dat") Then
FileDelete(@TempDir & "\update.dat")
Endif
InetGet("http://www.autoitscript.com/autoit3/files/beta/update.dat", @TempDir & "\update.dat")
if FileExists(@TempDir & "\update.dat") Then
TrayTip("Laden der Versionsliste erfolgreich!", "Laden der Versionsliste erfolgreich!", 2)
Else
TrayTip("Error", "Konnte keine Verbindung herstellen!", 5)
sleep(1000)
exit
Endif
sleep(2000)
if @error = 1 Then
MsgBox(0, "", "error")
endif
$version1 = IniRead(@TempDir & "\update.dat", "AutoIt", "version", "0")
$setup1 = IniRead(@TempDir & "\update.dat", "AutoIt", "setup", "0")
$version2 = IniRead(@TempDir & "\update.dat", "AutoItBeta", "version", "0")
$setup2 = IniRead(@TempDir & "\update.dat", "AutoItBeta", "setup", "0")
if $version1 <> $version1local Then
TrayTip("Achtung!", "Es gibt eine aktuellere Autoit Version! Die aktuellste Version heißt: " & $version1 & " , Ihre Version " & @Crlf & "ist Version : " & $version1local & @Crlf & " Sie wird jetzt heruntergeladen!", 5)
InetGet($setup1, @TempDir & "\setup.exe")
_install()
Else
trayTip("Aktuell", "Ihre Autoit Version ist auf dem neusten Stand!", 5)
EndIf
[/autoit] [autoit][/autoit] [autoit]sleep(6000)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]if $version2 <> $version2local Then
TrayTip("Achtung!", "Es gibt eine aktuellere Autoit - Beta - Version! Die aktuellste Version heißt: " & $version2 & " , Ihre Version " & @Crlf & "ist Version nummer: " & $version2local & @Crlf & " Sie wird jetzt heruntergeladen!", 5)
InetGet($setup2, @TempDir & "\setup.exe")
_install()
Else
trayTip("Aktuell", "Ihre Autoit - Beta - Version ist auf dem neusten Stand!", 5)
sleep(2000)
EndIf
EndFunc
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]Func _install()
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]If FileExists(@TempDir & "\setup.exe") Then
TrayTip("Installing", "Please don't move anything!", 2)
Run(@TempDir & "\setup.exe")
if WinActive("Autoit", "Beta") Then
[/autoit] [autoit][/autoit] [autoit]ControlClick("AutoIt", "beta", 2)
[/autoit] [autoit][/autoit] [autoit]Endif
sleep(1000)
WinwaitActive("Autoit", "Welcome")
ControlClick("AutoIt", "Welcome", 1)
sleep(1000)
WinWaitActive("Autoit", "Licence")
ControlClick("Autoit", "Licence", 1)
if WinActive("Autoit", "Previous") Then
WinWaitActive("Autoit", "Previous")
ControlClick("Autoit", "Previous", 1)
Endif
WinWaitActive("Autoit", "Default")
ControlClick("AutoIt", "Default", 1201)
ControlClick("AutoIt", "Default", 1)
sleep(1000)
WinWaitActive("AutoIt", "Choose")
ControlClick("AutoIt", "Choose", 1)
sleep(1000)
WinWaitActive("AutoIt", "Completing")
ControlClick("Autoit", "Completing", 1)
sleep(1000)
TrayTip("Finished", "Finished!!!!", 2)
Endif
EndFunc
Func _exit()
Exit
EndFunc
; ende funktionen
; -------------------------------------------------------------------------------------------------------------------
; GUI
; --------------------------------------------------------------------------------------------------------------------
opt("TrayAutoPause",0)
opt("TrayMenuMode",1)
opt("TrayOnEventMode",1)
TraySetClick(16)
$tray_trenner = TrayCreateItem("",-1,2)
$tray_ueber = TrayCreateItem("About It",-1,4)
$tray_trennerx = TrayCreateItem("",-1,5)
global $tray_autostart = TrayCreateItem("Autostart",-1,6)
$tray_tschuess = TrayCreateItem("Exit",-1,7)
TraySetOnEvent($tray_tschuess, "_exit")
TraySetOnEvent($tray_ueber, "_about")
TraySetOnEvent($tray_autostart, "_autostart")
if (RegRead($autostartkey,"autoupdateit")==@ScriptFullPath) then
TrayItemSetState($tray_autostart,$TRAY_CHECKED)
$autostart = TRUE
Else
TrayItemSetState($tray_autostart,$TRAY_UNCHECKED)
$autostart = FALSE
EndIf
Func _about()
TrayTip("About", "Geschrieben von Huggy")
EndFunc
func _autostart()
if ($autostart==FALSE) then
RegWrite($autostartkey,"autoupdateit","REG_SZ",@ScriptFullPath)
TrayItemSetState($tray_autostart,1)
$autostart = TRUE
Else
RegDelete($autostartkey,"autoupdateit")
TrayItemSetState($tray_autostart,4)
$autostart = FALSE
EndIf
EndFunc
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]; --------------------------------------------------------------------------------------------------------------
; schleife
Do
_check()
sleep(18000000)
Until $a = 0 ; da die anderen Schleifen Probleme Verursachen
Viel Spaß!
Bitte comments hier lassen =)