Jump to content
Sign in to follow this  
alexf

Alternative to WinWaitActive() ?

Recommended Posts

alexf

Hi, I'm writing a script to automate some video processing/editing. The section I need help with uses ImageJ (a free video processing suite in Java). Here's the problem: I need to save files of variable length. I have tried using WinWaitActive() for the main ImageJ window; however, the window becomes "active" before finished saving. This causes the "save" operation to be aborted when the next commands in the script are entered. So, what I need is some way to detect if ImageJ has finished saving the file before continuing. From the AutoIT Window tool, I've figured out that the ImageJ gui represents the save progress bar with this:

SunAwtCanvas

instance: 3

However, I get the feeling that it would be hard to figure out the progress based on this type of control (is it just a graphic, or can you use some function to get a numerical return?).

Massively long Sleep() statements seem to work OK, but I'd like a "robust" script that uses some feedback instead. Another way might be to read the size of the file being saved and base the Sleep() statement on that, but when I try it, the actual save time isn't that closely related to the size of the file and it changes from time to time.

Here's the code:

CODE

;save

Send("{ENTER}")

Sleep(20000)

WinActivate("ImageJ")

WinWaitActive("ImageJ")

If it matters, I've been testing this script over a remote desktop terminal (the script is running within the remote terminal, not on this end).

Thanks,

Alex

Share this post


Link to post
Share on other sites
BillLuvsU

if its a progress bar you could try using the function that gets the color of a pixel and checking to see if it is the color the progress bar turns into when filling up.


[center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw

Share this post


Link to post
Share on other sites
alexf

if its a progress bar you could try using the function that gets the color of a pixel and checking to see if it is the color the progress bar turns into when filling up.

I realize that this is possible with enough work, but it's not exactly a "conventional" way of solving this problem; I would like to know if there is a direct numerical way of reading the progress bar, or some variable I could read to tell if the saving is complete.

Someone suggested to me that I read the size of the file being saved every 5 seconds, and only proceed in the script when the readings don't change. This seems to be working, but it still doesn't seem like the most reliable method.

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.