# Decreasing progress bar

## Recommended Posts

Like title, my easy question is what is the calculation for make the progress bar start from 100 and go to 0?

This is a normal progress bar for example:

```#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <WindowsConstants.au3>

Global \$n = 10

\$Form = GUICreate("Form1", 341, 233, 197, 161)
\$Progress = GUICtrlCreateProgress(16, 40, 305, 25)
GUISetState(@SW_SHOW)

For \$i = 0 To \$n
\$ProgressSet = Int(\$i / (\$n) * 100)
GUICtrlSetData(\$Progress, \$ProgressSet)
Sleep(500)
Next

Exit```

Thank you

##### Share on other sites

Have you tried?

`For \$i = 100 To 0 Step -1`

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:

##### Share on other sites

No because the \$n is a number of folder so i need a For...Next to 0 to \$n, i can't make from 100 to 0

If Int(\$i / (\$n) * 100) = 0 to 100 how to make the opposite?

Edited by MyEarth

##### Share on other sites

The calculation is the same but instead of adding 1 in every iteration of the loop you subtract 1.

```For \$i = \$n  to 0 Step -1
\$ProgressSet = Int(\$i / (\$n) * 100)
GUICtrlSetData(\$Progress, \$ProgressSet)
Sleep(500)
Next```

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:

##### Share on other sites

Oh right, thank you

##### Share on other sites

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:

## Create an account

Register a new account