Jump to content
Sign in to follow this  
BBuck

Progress Bar - Help Request, Please

Recommended Posts

BBuck

Hi. I have been away from Autoit for a while. One of my last uses of it was with the last major version (v. 2, I think). I see now with version 3 there are great improvements, most notably GUI enhancements. I was hoping to get some assistance from the GUI experts here to enhance a small Autoit program that I use. This program receives and displays status changes/updates from scripted software installations. Please note that the program functions great and does exactly what it supposed to do- which is to read a registry key for any script generated registry updates and post that value/message to the status window.

However, I am now interested in enhancing this status dialog by adding a progress bar. I thought that message changes could mark percentages of completion (unless someone has a different idea how to calculate percentages). What I am not sure about doing is how to adapt the attached code to utilize a progress bar GUI Control. I have attempted to adapt several of the progress bar examples found in the 'Example Script' forum but have only experienced varying degrees of success. I'm sure this is mainly because of my lack of experience with the GUI Controls.

As you can see in the attached code, SplashText was utilized to create the display dialog. The structure and format certainly can be modified or enhanced to accomplish the same end result with an added progress bar. You will notice that the $Title variable is added and replaced to produce a flashing title bar effect. Besides the changing status message, this is the only motion showing apparent activity. A realtime progress bar would obviously produce a different effect.

I appreciate you taking the time to read my post. If you have any ideas about how to develop an enhanced solution, I sure wouldn't mind seeing them. Thanks in advance for any all insights!

-B. Buck

CODE
Opt("TrayIconHide", 1)

Opt("ExpandEnvStrings", 1)

Opt("ExpandVarStrings", 1)

Opt("MustDeclareVars", 1)

SplashOff( )

Dim $ProgressMsg, $Title, $OldTitle, $NewTitle, $AppTitle, $Height, $Width, $Xcoord, $Ycoord, $Position

$Title = "Automated Installation in Progress - Please wait..."

$OldTitle = "Automated Installation in Progress - "

$NewTitle = "Automated Installation in Progress - "

If $CmdLine[0] < 1 Then

$AppTitle = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Status", "ApplicationName")

Else

$AppTitle = $CmdLine[1]

EndIf

$Height = 67

$Width = 367

$Xcoord = 10

$Ycoord = 10

$ProgressMsg = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Status", "Message")

If $ProgressMsg <> "Setup Complete" Then

SplashTextOn($Title, "Installing: " & $AppTitle & @CRLF & @CRLF & $ProgressMsg, $Width, $Height, $Xcoord, $Ycoord, 16, "", "8", "500")

While $ProgressMsg <> "Setup Complete"

$NewTitle = $OldTitle

$OldTitle = $Title

WinSetTitle($Title, "", $NewTitle)

$Title = $NewTitle

ControlSetText($Title, "", "Static1", "Installing: " & $AppTitle & @CRLF & @CRLF & $ProgressMsg & @CRLF & @CRLF & "This dialog will terminate once the installation has completed.")

Sleep(750)

$ProgressMsg = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Status", "Message")

WEnd

EndIf

SplashOff( )

Share this post


Link to post
Share on other sites
BBuck

Look into AutoIt helpfile at ProgressOn, ProgressSet

I appreciate you taking the time to respond. I am familiar with the ProgressOn and ProgressSet functions. However, that will not produce the same functionality with an added progress bar.

Thanks.

-BBuck

Share this post


Link to post
Share on other sites
Zedna

Here are some examples:

ProgressOn("Progress Meter", "Increments every second", "0 percent")
For $i = 10 to 100 step 10
    sleep(1000)
    ProgressSet( $i, $i & " percent")
Next
ProgressSet(100 , "Done", "Complete")
sleep(500)
ProgressOff()oÝ÷ Ù«­¢+Ø¥¹±Õ±ÐíU%
½¹ÍѹÑ̹ÔÌÐì()U%
ÉÑ¡MÑÉ¥¹QÉ¥µI¥¡Ð¡MÉ¥ÁÑ9µ°Ð¤°ÈÈÀ°ÄÀÀ°´Ä°´Ä°ÀÌØí]M}
AQ%=8°ÀÌØí]M}a}Q=A5=MP¤((ÀÌØíÁɽÉÍÍÈôU%
Ñɱ
ÉÑAɽÉÍÌ ÄÀ°ÄÔ°ÈÀÀ°ÈÀ°ÀÌØíA M}M5==Q ¤(ÀÌØíÁɽ¹ÐôU%
Ñɱ
ÉÑ1° ÌäìÀÌäì°ÄÀ°ÐÀ°ÈÀÀ°ÈÀ°ÀÌØíMM}
9QH¤(ÀÌØíÍѽÀôU%
Ñɱ
ÉÑ    ÕÑѽ¸ ÅÕ½ÐíMѽÀÅÕ½Ðì°ÜÔ°Øà°ÜÀ°ÈÈ°ÀÌØí    M}AUM!  UQQ=8¤()U%MÑMÑÑ ¤((ÀÌØí¤ôÀ)]¡¥±Ä(ÀÌØíµÍôU%Ñ5Í ¤((%ÀÌØíµÍôÀÌØíÍѽÀ=HÀÌØíµÍôÀÌØíU%}Y9Q}
1=MQ¡¸á¥Ñ1½½À((ÀÌØí¤ôÀÌØí¤¬Ä(%ÀÌØí¤ÐìÄÀÀQ¡¸ÀÌØí¤ôÀ((U%
ÑɱMÑÑ ÀÌØíÁɽÉÍÍÈ°ÀÌØí¤¤(U%
ÑɱMÑÑ ÀÌØíÁɽ¹Ð°ÀÌØí¤µÀìÌäìÌäì¤((M±À ÄÀÀ¤)]¹oÝ÷ Ù«­¢+Ø¥¹±Õ±ÐíU%
½¹ÍѹÑ̹ÔÌÐì()U%
ÉÑ ÅÕ½ÐíQÍÐÅÕ½Ðì°ÈÈÀ°ÄÀÀ¤ì°´Ä°´Ä°ÀÌØí]M}
AQ%=8°ÀÌØí]M}a}Q=A5=MP¤(ÀÌØíÁɽÉÍÍÈôU%
Ñɱ
ÉÑAɽÉÍÌ ÄÀ°ÄÔ°ÈÀÀ°ÈÀ°ÀÌØíA M}M5==Q ¤(ÀÌØíÁɽ¹ÐôU%
Ñɱ
ÉÑ1° ÌäìÀÌäì°ÄÀ°ÐÀ°ÈÀÀ°ÈÀ°ÀÌØíMM}
9QH¤(ÀÌØíÍÑÉÐôU%
Ñɱ
ÉÑ    ÕÑѽ¸ ÅÕ½ÐíMÑÉÐÅÕ½Ðì°ÌÔ°Øà°ÜÀ°ÈȤ(ÀÌØíÍѽÀôU%
Ñɱ
ÉÑ    ÕÑѽ¸ ÅÕ½ÐíMѽÀÅÕ½Ðì°ÄÄÔ°Øà°ÜÀ°ÈȤ)U%
ÑɱMÑMÑÑ ÀÌØíÍѽÀ°ÀÌØíU%}%M  1¤)U%MÑMÑÑ ¤((ÀÌØíÉÕ¸ôÀ(ÀÌØí¤ôÀ()]¡¥±Ä(ÀÌØíµÍôU%Ñ5Í ¤((%ÀÌØíµÍôÀÌØíU%}Y9Q}
1=MQ¡¸á¥Ñ1½½À(%ÀÌØíµÍôÀÌØíÍÑÉÐQ¡¸($ÀÌØíÉÕ¸ôÄ(%U%
ÑɱMÑMÑÑ ÀÌØíÍÑÉаÀÌØíU%}%M  1¤(%U%
ÑɱMÑMÑÑ ÀÌØíÍѽÀ°ÀÌØíU%}9   1¤(¹%(%ÀÌØíµÍôÀÌØíÍѽÀQ¡¸($ÀÌØíÉÕ¸ôÀ(%U%
ÑɱMÑMÑÑ ÀÌØíÍÑÉаÀÌØíU%}9   1¤(%U%
ÑɱMÑMÑÑ ÀÌØíÍѽÀ°ÀÌØíU%}%M  1¤(¹%(%ÀÌØíÉÕ¸Q¡¸($ÀÌØí¤ôÀÌØí¤¬Ä(%%ÀÌØí¤ÐìÄÀÀQ¡¸ÀÌØí¤ôÀ((%U%
ÑɱMÑÑ ÀÌØíÁɽÉÍÍÈ°ÀÌØí¤¤(%U%
ÑɱMÑÑ ÀÌØíÁɽ¹Ð°ÀÌØí¤µÀìÌäìÌäì¤(%M±À ÄÀÀ¤(¹%)]¹

Share this post


Link to post
Share on other sites
BBuck

Thanks for responding with some examples... I will take a look at them and see if I can adapt one for this type of use.

Thanks.

BBuck.

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  

×