Jump to content

Simpler AutoUpdateIt for Newbiew :)


Madza91
 Share

Recommended Posts

Simple AutoUpdateIt.au3 from Autoit examples with pop-up message <_<

#Include <GUIConstants.au3>

Global Const $s_DatFile = 'http://www.autoitscript.com/autoit3/files/beta/update.dat'
Global Const $b_Download_UpdateDat = 1
Global Const $s_DatFile_Local = @TempDir & '\au3_update.dat'
Global $i_DatFileLoaded
Dim $s_ReleaseVer

$gui_Main = GUICreate("AutoUpdateIt", 350, 310 + 20)
$lb_Mn_ReleaseVer = GUICtrlCreateLabel('Version: Loading...', 15, 105, 145, 15)
GUICtrlSetState($lb_Mn_ReleaseVer, $GUI_Disable)
GUISetState(@SW_SHOW, $gui_Main)

If $b_Download_UpdateDat Then
    InetGet($s_DatFile, $s_DatFile_Local, 1, 1)
Else
    FileCopy(@ScriptDir & '\update.dat', $s_DatFile_Local); to test locally
EndIf

While 1
    $a_GMsg = GUIGetMsg(1)
    If Not @InetGetActive And Not $i_DatFileLoaded Then
        If @InetGetBytesRead = -1 And $b_Download_UpdateDat Then
            $i_Res = MsgBox(5 + 16 + 8192, 'Error', 'Error connecting to server.' & @LF & _
                    'Please verify the following:' & @LF & _
                    ' - You can connect to the internet' & @LF & _
                    ' - You can access the site http://www.AutoItScript.com' & @LF & _
                    ' - Your firewall is not blocking internet access to this program')
            If $i_Res = 4 Then
            Else
                Exit
            EndIf
        Else
            $s_ReleaseVer = IniRead($s_DatFile_Local, 'AutoIt', 'version', 'Error reading file')
            FileDelete($s_DatFile_Local)
            GUICtrlSetData($lb_Mn_ReleaseVer, 'Version: ' & $s_ReleaseVer)
            GUICtrlSetState($lb_Mn_ReleaseVer, $GUI_ENABLE)
            $i_DatFileLoaded = 1
            popup()
        EndIf
    EndIf
    If $a_GMsg[1] = $gui_Main Then
        Select
            Case $a_GMsg[0] = $GUI_EVENT_CLOSE
                Exit
        EndSelect
    EndIf
WEnd

Func popup()
    $Form1 = GUICreate("Sliding Toolbar", 180, 110, @DesktopWidth-200, @DesktopHeight-145,$WS_POPUP,$WS_EX_TOPMOST,$gui_Main)
    GUICtrlCreateLabel("New Update version: " & $s_ReleaseVer,10,10,150,100)
DllCall ( "user32.dll", "int", "AnimateWindow", "hwnd", $Form1, "int", 400, "long", 0x00040008 )
GuiSetState()
Sleep(2000)
DllCall ( "user32.dll", "int", "AnimateWindow", "hwnd", $Form1, "int", 1000, "long", 0x00090000 )
EndFunc

If you have better update checker, pls insert code :)

[quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...