PinkAngel Posted October 6, 2009 Share Posted October 6, 2009 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 More sharing options...
99ojo Posted October 6, 2009 Share Posted October 6, 2009 (edited) 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 October 6, 2009 by 99ojo Link to comment Share on other sites More sharing options...
Mecrazycoder Posted October 6, 2009 Share Posted October 6, 2009 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 AngelAre 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 More sharing options...
PinkAngel Posted October 6, 2009 Author Share Posted October 6, 2009 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 More sharing options...
TurionAltec Posted October 6, 2009 Share Posted October 6, 2009 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 More sharing options...
PinkAngel Posted October 8, 2009 Author Share Posted October 8, 2009 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now