Jump to content

how to link the progress bar with a time


Recommended Posts

  • Developers
11 minutes ago, nacerbaaziz said:

i want to set a progress bar for 10 sec

am waiting for your answers

What have you tried that isn't working?

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

Thought the helpfile example was what you where looking for but guess I am not understanding what you want.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

I will try to explain to you
Notice my brother
I want to create a progress bar
It is linked to a specific time
For example, a progress bar offers a period of 10 seconds
I will explain exactly what I want to do
I want to close the computer after 10 seconds and give the user the option of canceling
At this time I want to have a progress bar for time
Greetings
I apologize for the inconvenience and thank you in advancei know how to create a progress

but i need to linke it with a timer i don't know how to do it

can we do that?

Link to comment
Share on other sites

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("shutdown by AU3Builder", 300, 133, 192, 124)
$Progress1 = GUICtrlCreateProgress(16, 24, 209, 25)
$Label1 = GUICtrlCreateLabel("", 112, 112, 21, 17)
$Button1 = GUICtrlCreateButton(" Start Countdown", 64, 64, 105, 33)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
         Countdown(20,20)
    EndSwitch
WEnd

Func Countdown($progressbar,$label)
$I = 0
Do
Sleep(1000)
$I = $I + 1
$label = $label - 1
GUICtrlSetData($Progress1,$I/$progressbar*100)
GUICtrlSetData($Label1,$label)
Until $i = $progressbar
EndFunc

Here you are :)

Edited by Au3Builder
Link to comment
Share on other sites

Quote

Can you add a Cancel button when the progress bar is in progress?

Not using the code above.  Once the loop starts you are not processing messages.

Quote

I mean I want to link the progress bar to specific seconds

Can you explain this further.  Still unclear what you want to do.

kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

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

×
×
  • Create New...