Jump to content

How to create a script that will wait until a progress bar is completed before executing a script


Recommended Posts

Hi Guys,

I am creating a script that will select items on a listbox and delete them. My problem is that the application gets the data from an external database which makes loading to listbox rather slow. It has a progress bar which indicates that loading progress. How can I make my script wait for the progress bar to be completed before executing my script of selecting listbox items then deleting them? Your valuable help will be greatly appreciated.

thanks,

Pink Angel

Link to comment
Share on other sites

Hi,

;code before progress
ProgressOn ("Mytitle", "Mymaintext")
$percent = 0
While $percent < 101
    ProgressSet ($percent)
    $percent += 1
    sleep (100)
WEnd
ProgressOff ()
;code after progress

or

if you work with GuiCtrlSetData ($progressbar, $percent)

While GuiCtrlRead ($progressbar) < 101
    GuiCtrlSetData ($progresbar, $percent)
    $percent +=1 ; you have to change this to get your percentage value
    sleep (100)  ; in realtime you should have a sleep (20)
WEnd

;-))

Stefan

Edited by 99ojo
Link to comment
Share on other sites

Hi Guys,

I am creating a script that will select items on a listbox and delete them. My problem is that the application gets the data from an external database which makes loading to listbox rather slow. It has a progress bar which indicates that loading progress. How can I make my script wait for the progress bar to be completed before executing my script of selecting listbox items then deleting them? Your valuable help will be greatly appreciated.

thanks,

Pink Angel

Are you speaking about Multithreading? Like one thread keeps the progress bar alive and another thread populate the listbox in background. Is my understanding correct?

[size="4"][font="Arial Narrow"][font="Garamond"]Attitude is a little thing that makes a big difference[/font][/font][/size][indent][/indent]

Link to comment
Share on other sites

Are you speaking about Multithreading? Like one thread keeps the progress bar alive and another thread populate the listbox in background. Is my understanding correct?

Hi,

Yes, i think its multi- threading. the population of the listbox and the progress are already existing on the application. the script that i need to write is about selecting the listbox items and deleting them. but i can only do that if the list items are all loaded to the listbox which is indicated by a progress bar.

Link to comment
Share on other sites

I believe the OP is wanting to read the value in another program's progress bar, not create their own progress bar.

At first glance there's no "ControlGetvalue" that can read the value off another program's progress bar, nor do I see something in ANYGUI that can do it.

Two thoughts. If any of the controls in the Window change between being active or inactive (like a start stop button, or maybe even the progress bar itself) you could use ControlCommand("IsEnabled")

Another idea would be to do a ControlGetPos on the progress bar, then scan it with Pixelsearch until it finises. The downside being it won't work on every visual theme.

Link to comment
Share on other sites

hi,

thank you for your responses. Really appreciate them

@ TurionAlte: yes , you are right, the scenario is that AutoIT should read the value in another program's progress bar. I was able to resolve this issue by monitoring the window's Status Bar. Because upon first load, the Status Bar says "Restoring Details". When the data are completely loaded to the listbox, the status becomes "Ready". The below code solves my problem:

Do

$var = StatusbarGetText("MyWindow")

Sleep(1000)

Until $var = "Ready"

If (StatusbarGetText("MyWindow") = "Ready") Then

ControlListView("MyWindow", "", "SysListView321", "SelectAll")

EndIf

I've got one problem though. The Delete Button is inside a Toolbarwindow. Any idea how to access the buttons in a ToolbarWindow? I tried ControlClick but to no avail. Thanks a lot.

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