Sign in to follow this  
Followers 0
eJan

Help to have FileInstall with progress

3 posts in this topic

I'm using script to install new versions of exe and other files <> 2 Mb's with fake progress bar on clean machine without XP themes, but when used with themes it goes not as espected it would be.

This is a working part of script:

#include <GUIConstants.au3>

Dim $chkboxID[2]
Dim $chkbox[2]

Func _InstallFiles(); TO HAVE PROGRESS BAR..
    DirCreate(@ScriptDir & "\NEW")
    FileInstall(@ScriptDir & "\001.exe", @ScriptDir & "\NEW\001.exe", 1)
    FileInstall(@ScriptDir & "\002.exe", @ScriptDir & "\NEW\002.exe", 1)
EndFunc; BASED ON FileInstall (see line > 44

GUICreate("GUI", 226, 88); GUI Window
$grp = GuiCtrlCreateGraphic (2, 4, 221, 81, 0)
GUICtrlSetGraphic ($grp, $GUI_GR_COLOR, 0x000000)
GUICtrlSetGraphic ($grp, $GUI_GR_RECT, 0, 0, 221, 81)
$text = GUICtrlCreateLabel("Location..", 8, 10, 209, 29, $SS_SUNKEN)
GUICtrlSetBkColor($text, 0xF0EDE3)

$progress = GUICtrlCreateProgress(8, 43, 209, 16, $PBS_SMOOTH)
GUICtrlSetColor($progress, 0xFF7900)

$chkboxID[0] = GUICtrlCreateLabel("Install", 83, 63, 60, 17, $SS_CENTER)
$chkbox[0] = $GUI_UNCHECKED
GUICtrlSetFont($chkboxID[0], 10, 0, 0, "Verdana Bold")
$upd = GuiCtrlCreateGraphic (83, 63, 60, 17, 0)
GUICtrlSetGraphic ($upd, $GUI_GR_COLOR, 0x000000)
GUICtrlSetGraphic ($upd, $GUI_GR_RECT, 0, 0, 60, 17); GUI Window

GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $chkboxID[0]
            SetCheckBox($chkboxID[0], $chkbox[0])
    EndSelect
WEnd

Func SetCheckBox($id, ByRef $val)
    If $val = $GUI_UNCHECKED Then
        _InstallFiles(); START INSTALLING FILE(S)
        For $i = 1 To 100 Step 4; TO CREATE PROGRESS BASED ON...
            Sleep(1)
            GUICtrlSetData($progress, $i, $i)
            If $i > 95 Then
                GUICtrlSetData($id, "Close")
            EndIf
        Next; ... FUNCTION FileInstall
        $val = $GUI_CHECKED
        GUICtrlDelete($progress)
        $text2 = GUICtrlCreateLabel("INSTALLED", 8, 43, 209, 16, $SS_CENTER + $SS_SUNKEN)
        GUICtrlSetColor($text2, 0xF0EDE3)
        GUICtrlSetBkColor($text2, 0xFF7900)
    Else
        Exit
    EndIf
EndFunc

Please help me to have FileInstall based on DllCall real progress (line 7-11 and line 44-51). (Or at least real one progress bar).

Share this post


Link to post
Share on other sites



Why not have your _InstallFiles() function take a handle to a progress bar and update it from within there?

Func _InstallFiles($hProgress)
    GUICtrlSetData($hProgress, 0)
    DirCreate(@ScriptDir & "\NEW")
    FileInstall(@ScriptDir & "\001.exe", @ScriptDir & "\NEW\001.exe", 1)
    GUICtrlSetData($hProgress, 50)
    FileInstall(@ScriptDir & "\002.exe", @ScriptDir & "\NEW\002.exe", 1)
    GUICtrlSetData($hProgress, 100)
EndFunc; BASED ON FileInstall (see line > 44

Share this post


Link to post
Share on other sites

Thanks blindwig for suggestion, now it is real progress bar except when installing single large file.

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
Sign in to follow this  
Followers 0