Jump to content

Assistance with Creation of Progressbar


 Share

Recommended Posts

Hello Guys

I am really stumped in trying to create a progress bar. that works with conjunction of a process being launched by Autoit

I am wanting a progress bar to pop up once a button has been pressed, but display the progress bar while launching a process

Iv been looking at heaps of Examples but still bit lost.

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <SendMessage.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GuiToolTip.au3>
#include <file.au3>

$ProcessName1 = "Notepad.exe"

Func _progrssbar1

If ProcessExists($ProcessName1) then
progressOn("", "notepad Running", "0 Percent")
For $Progress1 = 1 to 100 Step 10
sleep(985)

ProgressSet($Progress1, $Progress1 & " Percent" )
next
ProgressSet(100, "Done", "Complete")

EndFunc

As you can see I'm stumped :D Im not sure ProgressSet can be "set" to monitor $processName1

I have tried using the example in Autoit and slightly adjusting by adding it into a function and with Runwait("Notepad.exe", "", "")

What it does is process through the progress Bar then perform the Runwait, I would like it As soon as Runwait() is called the progressbar is triggered?

any tip tricks would be appreciated.

ftc

Link to comment
Share on other sites

He has countable data (as useless as it is) in the For/Next. The problem is with the function

and the fact that there is no call to it. Add that to the fact the function syntax is incorrect and there is no EndIf and you have a mess.

Opt("WinTitleMatchMode", 2)
Run("Notepad.exe")
Do
    Sleep(1000)
Until WinActive("Notepad")
_progrssbar1()

Func _progrssbar1()
ProgressOn("", "notepad Running", "0 Percent", 0, 0, 16)
For $Progress1 = 10 to 100 step 10
    sleep(985)
    ProgressSet( $Progress1, $Progress1 & " percent")
Next
ProgressSet(100 , "Done", "Complete")
sleep(500)
ProgressOff()
EndFunc

By the way, code like this has no useful value since it's going to get to 100% in less than 10 seconds and then close the progress bar

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

He has countable data (as useless as it is) in the For/Next. The problem is with the function

and the fact that there is no call to it. Add that to the fact the function syntax is incorrect and there is no EndIf and you have a mess.

Opt("WinTitleMatchMode", 2)
Run("Notepad.exe")
Do
    Sleep(1000)
Until WinActive("Notepad")
_progrssbar1()

Func _progrssbar1()
ProgressOn("", "notepad Running", "0 Percent", 0, 0, 16)
For $Progress1 = 10 to 100 step 10
    sleep(985)
    ProgressSet( $Progress1, $Progress1 & " percent")
Next
ProgressSet(100 , "Done", "Complete")
sleep(500)
ProgressOff()
EndFunc

By the way, code like this has no useful value since it's going to get to 100% in less than 10 seconds and then close the progress bar

Thanks so much GeoSoft!

I adjusted your code to check for a running process ProcessExists("something") and slight adjusted the time running with step 5

and it works flawlessly :)

My application is now ready for production with over 200 lines of code. I have also added appreciation notes with reference to the Autoit Community in the html help file which is easily viewable by all who use the help file

I really like the Autoit community :)

ftc

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...