Sign in to follow this  
Followers 0
Donald8282

Get progress bar max

5 posts in this topic

Hello, I was wondering how to get the max on a progress bar. I looked in the help file but I couldn't find anything =[ Thanks in adv. -Donald8282

Share this post


Link to post
Share on other sites



Hello, I was wondering how to get the max on a progress bar. I looked in the help file but I couldn't find anything =[ Thanks in adv. -Donald8282

Sorry but what "get the max on a progress bar" means?. Maybe it's me but I don't understand your question.

Share this post


Link to post
Share on other sites

Max on a progress bar is always 100 (as in percent), you just have to do the math to convert to other scaled values.

Perhaps you were thinking of a slider control, where you can set the min/max values with GuiCtrlSetLimit().

:unsure:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

If you don't know the max, you can use a "waiting" progressbar like this :

#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <GUIConstants.au3>

$Ca = GUICreate ( "" , 250 , 46 , -1 , -1 , $WS_POPUP,$WS_EX_TOPMOST+$WS_EX_WINDOWEDGE+$WS_EX_DLGMODALFRAME )
GUISetBkColor ( 0x000000 , $Ca )
$Da = GUICtrlCreateLabel ("    Installing...",  23, -1, 250,23 )
GuiCtrlCreateGraphic ( -1, 1, 252,45,$SS_SUNKEN )
GUICtrlSetColor ( -1, 0XFFFFFF )
GUICtrlSetColor ( $Da, 0XFFFFFF)
GUICtrlSetFont ($Da, "12" , "50" , "" , "Courrier New" )
GUICtrlCreateGraphic ( 1, 23, 250,20 )
GUICtrlSetColor ( -1, 0x007F00 )
GuiSetState ( @SW_SHOW )

While 1
    _SliderRight ( )
    ;If Not ProcessExists ( $PID ) Then Exit
    _SliderLeft ()
    ;If Not ProcessExists ( $PID ) Then Exit
WEnd

Func _SliderRight ()
        Local $newcolor,$color = 0x000FF00
    For $m = 0 To 245 Step 5
        $newcolor += $color
        $ba = GUICtrlCreateLabel ( "", $m, 25, 4,16 )
        GUICtrlSetBkColor ( $ba, $newcolor )
        Sleep ( 50 )
    Next
EndFunc

Func _SliderLeft ()
    Local $backcolor,$color = 0x00FFFF00
    For $m = 245 To 0 Step -5
        $backcolor += $color
        $ba = GUICtrlCreateLabel ( "", $m, 25, 4,16 )
        GUICtrlSetBkColor ( $ba, $backcolor )
        Sleep ( 50 )
    Next
EndFunc

If it's for an installation you can get the size of the install dir and set progress until size is ok ! Posted Image


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

If you don't know the max, you can use a "waiting" progressbar like this :

#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <GUIConstants.au3>

$Ca = GUICreate ( "" , 250 , 46 , -1 , -1 , $WS_POPUP,$WS_EX_TOPMOST+$WS_EX_WINDOWEDGE+$WS_EX_DLGMODALFRAME )
GUISetBkColor ( 0x000000 , $Ca )
$Da = GUICtrlCreateLabel ("    Installing...",  23, -1, 250,23 )
GuiCtrlCreateGraphic ( -1, 1, 252,45,$SS_SUNKEN )
GUICtrlSetColor ( -1, 0XFFFFFF )
GUICtrlSetColor ( $Da, 0XFFFFFF)
GUICtrlSetFont ($Da, "12" , "50" , "" , "Courrier New" )
GUICtrlCreateGraphic ( 1, 23, 250,20 )
GUICtrlSetColor ( -1, 0x007F00 )
GuiSetState ( @SW_SHOW )

While 1
    _SliderRight ( )
    ;If Not ProcessExists ( $PID ) Then Exit
    _SliderLeft ()
    ;If Not ProcessExists ( $PID ) Then Exit
WEnd

Func _SliderRight ()
        Local $newcolor,$color = 0x000FF00
    For $m = 0 To 245 Step 5
        $newcolor += $color
        $ba = GUICtrlCreateLabel ( "", $m, 25, 4,16 )
        GUICtrlSetBkColor ( $ba, $newcolor )
        Sleep ( 50 )
    Next
EndFunc

Func _SliderLeft ()
    Local $backcolor,$color = 0x00FFFF00
    For $m = 245 To 0 Step -5
        $backcolor += $color
        $ba = GUICtrlCreateLabel ( "", $m, 25, 4,16 )
        GUICtrlSetBkColor ( $ba, $backcolor )
        Sleep ( 50 )
    Next
EndFunc

If it's for an installation you can get the size of the install dir and set progress until size is ok ! Posted Image

Actually, I just realised it's out of 100%... I forgot "%" so, now I can just use it how I need to. I am using it to show how much more Exp you need in a text-based game I want to create. Nothing big but just something simple right now. Like just "Fight", "Magic", and "Food/Heal" buttons

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