Created
August 19, 2023 16:44
-
-
Save Habetdin/c8f6b6ac0ee4a020bca9f05dd76732eb to your computer and use it in GitHub Desktop.
Infinite Progress Bar in AutoIt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; AutoIt: Infinite Progress Bar | |
; Source: https://www.autoitscript.com/forum/topic/125697-_progresssetmarquee-startsstops-the-pbs_marquee-style-on-a-progressbar/?do=findComment&comment=874763 | |
#include <GUIConstantsEx.au3> | |
#include <ProgressConstants.au3> | |
Example() | |
Func Example() | |
Local $hGUI = GUICreate('Marquee ProgressBar', 300, 90) | |
Local $iProgressBar = GUICtrlCreateProgress(10, 10, 280, 20, $PBS_MARQUEE) ; Create a progressbar using the marquee style | |
Local $iStart = GUICtrlCreateButton('Start', 30, 60, 85, 25) | |
Local $iStop = GUICtrlCreateButton('Stop', 120, 60, 85, 25) | |
Local $iReset = GUICtrlCreateButton('Stop && Reset', 210, 60, 85, 25) | |
GUISetState(@SW_SHOW, $hGUI) | |
While 1 | |
Switch GUIGetMsg() | |
Case $GUI_EVENT_CLOSE | |
ExitLoop | |
Case $iStart | |
_ProgressMarquee_Start($iProgressBar) ; Start the marquee effect | |
Case $iStop | |
_ProgressMarquee_Stop($iProgressBar) ; Stop the marquee effect | |
Case $iReset | |
_ProgressMarquee_Stop($iProgressBar, True) ; Stop the marquee effect and reset the progressbar | |
EndSwitch | |
WEnd | |
; Tidy resources | |
GUIDelete($hGUI) | |
EndFunc ;==>Example | |
; #FUNCTION# ==================================================================================================================== | |
; Name ..........: _ProgressMarquee_Start | |
; Description ...: Start the marquee effect | |
; Syntax ........: _ProgressMarquee_Start($iControlID) | |
; Parameters ....: $iControlID - ControlID of a progressbar using the $PBS_MARQUEE style | |
; Return values .: Success - True | |
; Failure - False | |
; Author ........: guinness | |
; Example .......: Yes | |
; =============================================================================================================================== | |
Func _ProgressMarquee_Start($iControlID) | |
Return GUICtrlSendMsg($iControlID, $PBM_SETMARQUEE, True, 50) | |
EndFunc ;==>_ProgressMarquee_Start | |
; #FUNCTION# ==================================================================================================================== | |
; Name ..........: _ProgressMarquee_Stop | |
; Description ...: Stop the marquee effect | |
; Syntax ........: _ProgressMarquee_Stop($iControlID[, $bReset = False]) | |
; Parameters ....: $iControlID - ControlID of a progressbar using the $PBS_MARQUEE style | |
; $bReset - [optional] Reset the progressbar, True - Reset or False - Don't reset. Default is False | |
; Return values .: Success - True | |
; Failure - False | |
; Author ........: guinness | |
; Example .......: Yes | |
; =============================================================================================================================== | |
Func _ProgressMarquee_Stop($iControlID, $bReset = False) | |
Local $bReturn = GUICtrlSendMsg($iControlID, $PBM_SETMARQUEE, False, 50) | |
If $bReturn And $bReset Then | |
GUICtrlSetStyle($iControlID, $PBS_MARQUEE) | |
EndIf | |
Return $bReturn | |
EndFunc ;==>_ProgressMarquee_Stop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment