Jump to content

Recommended Posts

Posted (edited)

Dear Experts,

I need a great help of writing a code showing actual and real progress of installing any software

and showing distribution of files on the Drive C:\\ for example

Please help from experts Especially dear UEZ

here is my code :

#NoTrayIcon
#RequireAdmin
#include <GDIPlus.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <Math.au3>
#include <StaticConstants.au3>
WinMinimizeAll()

Opt("GUIOnEventMode", 1)
HotKeySet("{ESC}", "_Exit")
_GDIPlus_Startup()
;Global Const $STM_SETIMAGE = 0x0172; $IMAGE_BITMAP = 0
Global $iW = 480, $iH = 40, $iBGColor = 0xe4f9e6  ;0xFFFFFF
;Global Const $hGUI = GUICreate("Strip Progressbar", $iW, $iH, -1, -1, BitOR($WS_POPUPWINDOW, $WS_THICKFRAME), $WS_EX_TOPMOST)
Global Const $hGUI = GUICreate("", $iW, $iH, -1, -1, BitOR($DS_MODALFRAME, $WS_POPUPWINDOW, $WS_EX_TOOLWINDOW), $WS_EX_LAYERED + $WS_EX_TOPMOST, WinGetHandle(AutoItWinGetTitle()))
GUISetBkColor($iBGColor)

Global Const $iPic = GUICtrlCreatePic("", 0, 0, $iW, $iH, -1, $GUI_WS_EX_PARENTDRAG)
GUICtrlSetState(-1, $GUI_DISABLE)

Global $labelb = GUICtrlCreateLabel("Installing VLC Media Player", 0, 0, $iW, $iH, $SS_CENTER)
GUICtrlSetState($labelb, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetFont(+ -  1  ,  12  , 0x0320 ,  0  , "Segoe UI"  )
GUICtrlSetColor($labelb    , 0x487F05  )

GUISetState()

Local $installDir = @HomeDrive & '\Program Files\VideoLAN\VLC'
Local $installSize = 170954752  ;size in bytes
_Install()

While 1
    Sleep(500)
WEnd

Func _exit()
    _GDIPlus_Shutdown()
    GUIDelete()
    Exit
    Exit
EndFunc

Func _Install()
    $programFilesSize = DirGetSize($installDir)
    If  @OSArch      = "X86"     Then
        $pid = Run(@ScriptDir & '\vlc-3.0.21-win32.exe /S')
    ElseIf @OSArch   = "X64"     Then
        $pid = Run(@ScriptDir & '\vlc-3.0.21-win64.exe /S')
    EndIf
While ProcessExists ( $pid )
    $dirSize = DirGetSize ( $installDir )
    $dirSize = $dirSize - $programFilesSize
    ;$_Percent = Int(100 / $installSize * $dirSize)
    $_Percent = 100 / $installSize * $dirSize
    $_Percent = _Max ( _Min ( $_Percent, 99 ), 0 )
    $Var0088 = 100 / $installSize * $dirSize
    $Var0088 = _Max ( _Min ( $Var0088, 99 ), 0 )

    If $Var0088 >= 100 Then
        $Var0088 = 0
        $iRandom = Random(0, UBound($aColors) - 1, 1)
        $iColorTP = BitShift(BitAND(BitAND(0x00FFFFFF, $aColors[$iRandom][1]), 0xFF), -16) + BitAND(0x0000FF00, $aColors[$iRandom][1]) + BitShift(BitAND(BitAND(0x00FFFFFF, $aColors[$iRandom][1]), 0xFF0000), 16) ;convert to BGR
    EndIf
WEnd

_GDIPlus_Shutdown()
GUIDelete()
Exit
EndFunc   ;==>_Install

 

link to VLC :

https://www.videolan.org/vlc/

 

This progressbar during Install based on any of :

- Change of installed directory size

- No of distributed files

- No of copied files to install directory

- Time lapsed during Install

- Others

We need actual & real progress indicating install of VLC (as example) resempling progressbar of install of any famous softwares

this code i need good looking colored progressbar 

Thanks in advance

Edited by Davidyese

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
  • Recently Browsing   0 members

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