Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Progress bar with text box and apps running

$
0
0
I am beginner in the autoit programming. Would be necessary to simplify my code.

[ autoit ]         
#include <GUIConstantsEx.au3> #include <ProgressConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Include <ScrollBarConstants.au3> #Include <GUIEdit.au3> #Region ### START Koda GUI section ### Form= $Title = "Installing Applications" $sText = "Preparing..." $Form1 = GUICreate($Title, 512, 216, -1, -1, -1) ;BitOR($WS_EX_TOPMOST,$WS_EX_WINDOWEDGE)) $Edit1 = GUICtrlCreateEdit($sText, 24, 64, 462, 128, BitOR($ES_AUTOVSCROLL,$ES_READONLY,$ES_WANTRETURN,$WS_VSCROLL)) $Progress1 = GUICtrlCreateProgress(24, 24, 462, 16) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $ms = 1000 While 1     $nMsg = GUIGetMsg()     Switch $nMsg         Case $GUI_EVENT_CLOSE             Exit         Case Install()             $iEnd = StringLen(GUICtrlRead($Edit1))             _GUICtrlEdit_SetSel($Edit1, $iEnd, $iEnd)             _GUICtrlEdit_Scroll($Edit1, $SB_SCROLLCARET)             GUICtrlSetData($Edit1, " done.", 1)             Sleep($ms)             MsgBox(0,$Title,"Installation is complete.")             ExitLoop     EndSwitch WEnd Func Install()     $a = 7     $e = 100 / $a     $p = 0     $n = 1     $p = $e * $n     $aName = ("[" & $n & " of " & $a & "] - 7-Zip...")     Run("calc.exe") ; RunWait(@ScriptDir & "\7z922.exe" & " /S","",@SW_HIDE)     GuiCtrlSetData($Progress1, $p)     $iEnd = StringLen(GUICtrlRead($Edit1))     _GUICtrlEdit_SetSel($Edit1, $iEnd, $iEnd)     _GUICtrlEdit_Scroll($Edit1, $SB_SCROLLCARET)     GUICtrlSetData($Edit1, " done." & @CRLF & $aName, 1)     Sleep($ms)     $n = $n + 1     $p = $e * $n     $aName = ("[" & $n & " of " & $a & "] - Adobe Reader...")     Run("calc.exe") ; RunWait(@ScriptDir & "\AdbeRdr_1000_en_US.exe" & " /sAll /msi /norestart ALLUSERS=1 EULA_ACCEPT=YES","",@SW_HIDE)     GuiCtrlSetData($Progress1, $p)     $iEnd = StringLen(GUICtrlRead($Edit1))     _GUICtrlEdit_SetSel($Edit1, $iEnd, $iEnd)     _GUICtrlEdit_Scroll($Edit1, $SB_SCROLLCARET)     GUICtrlSetData($Edit1, " done." & @CRLF & $aName, 1)     Sleep($ms)     $n = $n + 1     $p = $e * $n     $aName = ("[" & $n & " of " & $a & "] - Audacity®, the Free, Cross-Platform Sound Editor...")     Run("calc.exe") ; RunWait(@ScriptDir & "\audacity-win-2.0.3.exe" & " /sp- /verysilent /norestart","",@SW_HIDE)     GuiCtrlSetData($Progress1, $p)     $iEnd = StringLen(GUICtrlRead($Edit1))     _GUICtrlEdit_SetSel($Edit1, $iEnd, $iEnd)     _GUICtrlEdit_Scroll($Edit1, $SB_SCROLLCARET)     GUICtrlSetData($Edit1, " done." & @CRLF & $aName, 1)     Sleep($ms)     $n = $n + 1     $p = $e * $n     $aName = ("[" & $n & " of " & $a & "] - Mozilla Firefox...")     Run("calc.exe") ; RunWait(@ScriptDir & "\Firefox Setup 19.0.2" & " -ms","",@SW_HIDE)     GuiCtrlSetData($Progress1, $p)     $iEnd = StringLen(GUICtrlRead($Edit1))     _GUICtrlEdit_SetSel($Edit1, $iEnd, $iEnd)     _GUICtrlEdit_Scroll($Edit1, $SB_SCROLLCARET)     GUICtrlSetData($Edit1, " done." & @CRLF & $aName, 1)     Sleep($ms)     $n = $n + 1     $p = $e * $n     $aName = ("[" & $n & " of " & $a & "] - Skype...")     Run("calc.exe") ; RunWait(@ScriptDir & "\SkypeSetupFull.exe" & " /noie /nogoogle /verysilent /norestart","",@SW_HIDE)     GuiCtrlSetData($Progress1, $p)     $iEnd = StringLen(GUICtrlRead($Edit1))     _GUICtrlEdit_SetSel($Edit1, $iEnd, $iEnd)     _GUICtrlEdit_Scroll($Edit1, $SB_SCROLLCARET)     GUICtrlSetData($Edit1, " done." & @CRLF & $aName, 1)     Sleep($ms)     $n = $n + 1     $p = $e * $n     $aName = ("[" & $n & " of " & $a & "] - VLC media player...")     Run("calc.exe") ; RunWait(@ScriptDir & "\vlc-2.0.4-win32.exe" & " /S","",@SW_HIDE)     GuiCtrlSetData($Progress1, $p)     $iEnd = StringLen(GUICtrlRead($Edit1))     _GUICtrlEdit_SetSel($Edit1, $iEnd, $iEnd)     _GUICtrlEdit_Scroll($Edit1, $SB_SCROLLCARET)     GUICtrlSetData($Edit1, " done." & @CRLF & $aName, 1)     Sleep($ms)     $n = $n + 1     $p = $e * $n     $aName = ("[" & $n & " of " & $a & "] - Winamp...")     Run("calc.exe") ; RunWait(@ScriptDir & "\winamp563_full_emusic-7plus_all.exe" & " /S /install=SDRA","",@SW_HIDE)     GuiCtrlSetData($Progress1, $p)     $iEnd = StringLen(GUICtrlRead($Edit1))     _GUICtrlEdit_SetSel($Edit1, $iEnd, $iEnd)     _GUICtrlEdit_Scroll($Edit1, $SB_SCROLLCARET)     GUICtrlSetData($Edit1, " done." & @CRLF & $aName, 1)     Sleep($ms)     ; etc. EndFunc

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>