Jump to content
Sign in to follow this  
EssDee

Wait while Excel get data

Recommended Posts

Hi!

This is my first post! :)

This is done with an Auto-It script:

Opening an excel-file and click a button to update data. This update can take 5 sek to minutes. What shall I write in the script for it to wait while the dataupdate occur? The script is supposed to do more after the dataupdate.

/EssDee

Share this post


Link to post
Share on other sites

Hi!

This is my first post! ^_^

This is done with an Auto-It script:

Opening an excel-file and click a button to update data. This update can take 5 sek to minutes. What shall I write in the script for it to wait while the dataupdate occur? The script is supposed to do more after the dataupdate.

/EssDee

If you automate Excel with keyboard/mouse simulation, you are left with a blind Sleep(5000), or some such, hoping to wait long enough for it to be done on the worst-case config that might run it.

If you use the COM interface then functions that might take a while (like a complex sort) simply block the script until they are done. It would be nice for Office apps to have a "Busy Flag" you could check, but it just doesn't appear to exist.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Opening an excel-file and click a button to update data.

Does that button call a macro function? If so you might be able to modify it to send an alert that your script can detect.

Otherwise, how do you know when it finished? Are any controls disabled, or is there specific data you can look at to verify?


[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Share this post


Link to post
Share on other sites

Hi again

The only way I figured out is to check the cursor...

When excel is collecting data the cursor shows a wait symbol and then it's finished it goes back to the ordinary arrow.

The cursor has ID 15 then waiting and goes back to ID 0 then idle.

Code:

Do Until MouseGetCursor() = 0

Loop

This don't feels like a very safe solution but it works... so far...

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  

×
×
  • Create New...