Jump to content

Is my window gone, or not yet come up?


ljmeijer
 Share

Recommended Posts

Hey,

I'm trying to script a function (publish) in an application (macromedia director).

When you publish, a progress window appears. It might take a while for this progress bar to come up (if it has to look for some files on a network first orso)..

The progresswindow might also be ready very quickly.

While writing my script, I need to know if the publish is already done. The window can go so fast, that if I search for it using WinExists("publishwindowname") right after I do the publish (trough WinMenuSelectItem) it is already gone.

I have WinWaitDelay set to 0.

It seems there is quite some lag using the windowing functions. I'm not sure if it is possible with AutoIt to accomplish this, other than setting some really high timeout, assuming that if it takes that long, we probably missed the window.

Any smart ideas?

Thanks, Lucas

Link to comment
Share on other sites

Welcome to the forums!

Maybe an approach like this will work:

winMenuSelectItem(...)

; wait one second for progress window to appear
$progressOpen = winWait("Scanning...", "", 1)

; if it appeared then wait for it to close
if $progressOpen then winWaitClose("Scanning...")

; otherwise assume that the window opened and closed before we started winWaiting
Link to comment
Share on other sites

Hey Guys,

Thanks for the replies. The problem with both your solutions IMHO is that the time it could take for the window to pop up is really large. So waiting for N seconds, and if it hasn't shown its face then, assume that it has and already is gone is a big opening for the script to fail. The publish window might popup 10 seconds later.. or 20.. or I don't know how long in the most unfortunatte circumstance.

I could pick an unreasonably long time, say 2 minutes, but then I'd have to wait 2 minutes every time the dialog is gone so fast that the script didn't catch it ;)..

Bye, Lucas

Link to comment
Share on other sites

  • Moderators

Well... do you need to have this window's functions completed before you complete the rest of your actions? If so... the WinWait() is the way to go.

If you're doing something like:

Func MyFunc()
;do something
;do something
;This is the window i need
;do something
;do something
EndFunc

Then you could use a Do statement

Func MyFunc()
Do
;all my functions
Until WinExists("Window I'm Waiting On")
;Now do my Window function i've been waiting on
; and now maybe a while statement or endfunc
EndFunc

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Is there any other form of notification that the task has completed (text change in status bar, etc.)?

Perhaps the window becomes unresponsive to further commands while it is processing the current one. If so, you can rely on this by simply continuing to issue commands.

Link to comment
Share on other sites

Any smart ideas?

Along the lines of LxP, doesn't the fact that the "publish" progress bar exists mean that something is "published"? How about checking the target location for the published files to see if they are there yet? This could be done locally with "fileexists" or over ftp with something corresponding to "fileexists"...
...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
Link to comment
Share on other sites

Thanks for the ideas guys. I've got a testversion now running that checks if it can open the published file with a writelock.. if it can, director must be done with the publishing... I'm running into the same problem with some other actions I need to automate though that don't have any physical output I can detect progress from.. Some change the applications windowtitle when done, so those are easy to check... I've also tried continueing issueing commands, like trying to open the about box, but unfortunattely the about box always comes up, also when the app is busy...

Thanks again, Lucas

Link to comment
Share on other sites

Thanks for the ideas guys. I've got a testversion now running that checks if it can open the published file with a writelock..  if it can, director must be done with the publishing...   

Lucas, can you share your code with us? It will add to the knowledge-base as well as collect useful comments for you...
...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
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...