Jump to content

how to make progress bar move?


NegativeNrG
 Share

Recommended Posts

hi all, i need help with parts of my scripts, i was wondering if you can help me. what i want to do is When i press start ( in the program) the progress bar loads, when it reaches the end it goes back down and keeps looping until i press the stop button.

#include <GUIConstants.au3>
;
GUICreate("x", 412, 297, 363, 276, $WS_OVERLAPPEDWINDOW)
$Button1 = GUICtrlCreateButton("Start", 320, 240, 75, 25)
$Button1 = GUICtrlCreateButton("About", 8, 264, 75, 25)
$Button2 = GUICtrlCreateButton("Stop", 320, 272, 75, 25)
$RadioButton1 = GUICtrlCreateRadio("x", 24, 24, 113, 17)
$RadioButton2 = GUICtrlCreateRadio("x", 24, 72, 113, 17)
$RadioButton3 = GUICtrlCreateRadio("x", 24, 96, 113, 17)
$RadioButton4 = GUICtrlCreateRadio("x", 24, 120, 113, 17)
$RadioButton5 = GUICtrlCreateRadio("x", 24, 144, 113, 17)
$RadioButton6 = GUICtrlCreateRadio("x", 24, 168, 113, 17)
$RadioButton7 = GUICtrlCreateRadio("x", 192, 24, 113, 17)
$RadioButton8 = GUICtrlCreateRadio("x", 192, 48, 113, 17)
$RadioButton9 = GUICtrlCreateRadio("x", 192, 72, 113, 17)
$RadioButton10 = GUICtrlCreateRadio("x", 192, 96, 113, 17)
$RadioButton11 = GUICtrlCreateRadio("x", 192, 120, 113, 17)
$RadioButton12 = GUICtrlCreateRadio("x", 192, 144, 113, 17)
$RadioButton13 = GUICtrlCreateRadio("x", 192, 168, 113, 17)
$RadioButton14 = GUICtrlCreateRadio("x", 24, 48, 113, 17)
$ProgressBar1 = GUICtrlCreateProgress(104, 192, 150, 17)

$TrackBar1 = GUICtrlCreateSlider(8, 216, 310, 45, BitOR($TBS_AUTOTICKS,$TBS_RIGHT,$TBS_HORZ))
GUISetState(@SW_SHOW)

While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
                   Case $msg = $Button1
                   msgbox (0, "About", "x - Thanks to x")
    Case Else
;;;
    EndSelect
WEnd
Exit

THanks to all

Edited by NegativeNrG

[size=20]My File Upload[/size]Register at my site and upload.

Link to comment
Share on other sites

Here you go:

#include <GUIConstants.au3>
;
GUICreate("x", 412, 297, 363, 276, $WS_OVERLAPPEDWINDOW)
$Button1 = GUICtrlCreateButton("Start", 320, 240, 75, 25)
$Button2 = GUICtrlCreateButton("About", 8, 264, 75, 25)
$Button3 = GUICtrlCreateButton("Stop", 320, 272, 75, 25)
$RadioButton1 = GUICtrlCreateRadio("x", 24, 24, 113, 17)
$RadioButton2 = GUICtrlCreateRadio("x", 24, 72, 113, 17)
$RadioButton3 = GUICtrlCreateRadio("x", 24, 96, 113, 17)
$RadioButton4 = GUICtrlCreateRadio("x", 24, 120, 113, 17)
$RadioButton5 = GUICtrlCreateRadio("x", 24, 144, 113, 17)
$RadioButton6 = GUICtrlCreateRadio("x", 24, 168, 113, 17)
$RadioButton7 = GUICtrlCreateRadio("x", 192, 24, 113, 17)
$RadioButton8 = GUICtrlCreateRadio("x", 192, 48, 113, 17)
$RadioButton9 = GUICtrlCreateRadio("x", 192, 72, 113, 17)
$RadioButton10 = GUICtrlCreateRadio("x", 192, 96, 113, 17)
$RadioButton11 = GUICtrlCreateRadio("x", 192, 120, 113, 17)
$RadioButton12 = GUICtrlCreateRadio("x", 192, 144, 113, 17)
$RadioButton13 = GUICtrlCreateRadio("x", 192, 168, 113, 17)
$RadioButton14 = GUICtrlCreateRadio("x", 24, 48, 113, 17)
$ProgressBar1 = GUICtrlCreateProgress(104, 192, 150, 17)

$TrackBar1 = GUICtrlCreateSlider(8, 216, 310, 45, BitOR($TBS_AUTOTICKS,$TBS_RIGHT,$TBS_HORZ))
GUISetState(@SW_SHOW)

While 1
$msg = GuiGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        
        Case $msg = $Button1
            $i = 1
            Do
                Sleep(100)
                GUICtrlSetData($progressbar1,$i)
                $i = $i + 1
            Until GUICtrlRead($progressbar1) = 100  
        
        Case $msg = $Button2
            msgbox (0, "About", "x - Thanks to x")
        Case Else
    ;;;
    EndSelect
WEnd
Exit
Link to comment
Share on other sites

#include <GUIConstants.au3>

;

GUICreate("x", 412, 297, 363, 276, $WS_OVERLAPPEDWINDOW)

$Button1 = GUICtrlCreateButton("Start", 320, 240, 75, 25)

$Button2 = GUICtrlCreateButton("About", 8, 264, 75, 25)

$Button3 = GUICtrlCreateButton("Stop", 320, 272, 75, 25)

$RadioButton1 = GUICtrlCreateRadio("x", 24, 24, 113, 17)

$RadioButton2 = GUICtrlCreateRadio("x", 24, 72, 113, 17)

$RadioButton3 = GUICtrlCreateRadio("x", 24, 96, 113, 17)

$RadioButton4 = GUICtrlCreateRadio("x", 24, 120, 113, 17)

$RadioButton5 = GUICtrlCreateRadio("x", 24, 144, 113, 17)

$RadioButton6 = GUICtrlCreateRadio("x", 24, 168, 113, 17)

$RadioButton7 = GUICtrlCreateRadio("x", 192, 24, 113, 17)

$RadioButton8 = GUICtrlCreateRadio("x", 192, 48, 113, 17)

$RadioButton9 = GUICtrlCreateRadio("x", 192, 72, 113, 17)

$RadioButton10 = GUICtrlCreateRadio("x", 192, 96, 113, 17)

$RadioButton11 = GUICtrlCreateRadio("x", 192, 120, 113, 17)

$RadioButton12 = GUICtrlCreateRadio("x", 192, 144, 113, 17)

$RadioButton13 = GUICtrlCreateRadio("x", 192, 168, 113, 17)

$RadioButton14 = GUICtrlCreateRadio("x", 24, 48, 113, 17)

$ProgressBar1 = GUICtrlCreateProgress(104, 192, 150, 17)

$TrackBar1 = GUICtrlCreateSlider(8, 216, 310, 45, BitOR($TBS_AUTOTICKS,$TBS_RIGHT,$TBS_HORZ))

GUISetState(@SW_SHOW)

While 1

$msg = GuiGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

Case $msg = $Button1

$i = 1

While 1

Sleep(10)

$msg = GuiGetMsg()

If $msg = $Button3 Then ExitLoop

If $msg = $GUI_EVENT_CLOSE Then Exit

GUICtrlSetData($progressbar1,$i)

$i = $i + 1

If $i = 100 Then $i = 0

WEnd

Case $msg = $Button2

msgbox (0, "About", "x - Thanks to x")

Case Else

;;;

EndSelect

WEnd

Exit

Link to comment
Share on other sites

a good example... with reverse like you asked about

straight from help

#include <GUIConstants.au3>

GUICreate("My GUI Progressbar",220,100, 100,200)
$progressbar1 = GUICtrlCreateProgress (10,10,200,20)
GUICtrlSetColor(-1,32250); not working with Windows XP Style
$progressbar2 = GUICtrlCreateProgress (10,40,200,20,$PBS_SMOOTH)
$button = GUICtrlCreateButton ("Start",75,70,70,20)
GUISetState ()

$wait = 20; wait 20ms for next progressstep
$s = 0; progressbar-saveposition
do
$msg = GUIGetMsg()
If $msg = $button Then
    GUICtrlSetData ($button,"Stop")
    For $i = $s To 100
    If GUICtrlRead($progressbar1) = 50 Then Msgbox(0,"Info","The half is done...", 1)
    $m = GUIGetMsg ()
    
    If $m = -3 Then ExitLoop
    
    If $m = $button Then
      GUICtrlSetData ($button,"Next")
      $s = $i;save the current bar-position to $s
      ExitLoop
    Else
        $s=0
      GUICtrlSetData ($progressbar1,$i)
      GUICtrlSetData ($progressbar2,(100 - $i))
      Sleep($wait)
    EndIf
    Next
    if $i >100 then
;       $s=0
        GUICtrlSetData ($button,"Start")
    endif
EndIf
until $msg = $GUI_EVENT_CLOSE

8)

NEWHeader1.png

Link to comment
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
 Share

  • Recently Browsing   0 members

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