Jump to content
Sign in to follow this  

Adding A Progress Bar

Recommended Posts



I know the you use ProgressOn(), ProgressSet(), and ProgressOff() to add a progress bar to something, but I just cant figure out how to add one in this situation.

This script goes out to network computers and sees if there are files in a certain folder on each machine, there are a total of 88 computers and that is how many lines are in the document it reads the names from, I figured this would be a good way to base the progress.

#Include <File.au3>
#Include <Array.au3>
FileInstall("C:\Documents and Settings\OvittKe\My Documents\scripts\ADR\Names.txt", @ScriptDir & "\", 1)
FileInstall("C:\Documents and Settings\OvittKe\My Documents\scripts\ADR\tada.wav", @ScriptDir & "\", 1)
$count = 0
$PC_File = FileOpen("Names.txt",0)

ProgressOn("ADR FTP SCAN", "Percent Complete", "Progress",16)
    $Line_Number = _FileCountLines("Names.txt") ;Number of lines in Names.txt
While True
        $CompName = FileReadLine($PC_File) ;Reads the computer name from Names.txt
            If @error = -1 Then 
                $count = $count+1
        $Files = _FileListToArray("\\"&$CompName&"\c$\adr\data")
        If @error = 1 Then
            $Files_Re = _FileListToArray("\\"&$CompName&"\c$\adr\data")
                If @error = 1 Then
                    $PingValue = ping($compName) 
                    If $PingValue = 0 Then
                        MsgBox(0, "Error", "Unable to connenct to Machine "&$CompName&"!")
            If @error <> 4 Then
                If $Files[0] >= 10 Then
                    MsgBox(1,"ADR FTP", "The Machine "&$CompName&" is not executing the ftp service.") 
                If Mod($count,10) = 0 Then
                    MsgBox(0,"Update:","Currently Scanning "&$CompName)

MsgBox(0,"Complete","The Scan has succesfully been completed.")

If anyone can give any suggestions that would be great. Thanks a ton!

Share this post

Link to post
Share on other sites

You will use ProgressSet() to set the percentage relative to the number computers using $Line_Number + $count.

Lets say $Line_Number = 88

$Percent = ($count / $Line_Number) * 100

If $count is 22 then $Percent =25

If $count is 44 then $Percent = 50


Share this post

Link to post
Share on other sites

Wow.. I feel like an idiot for not realizing that...

Thanks soooo Much!! I really appreciate it! :)

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.