Jump to content

Problems with WinWait & WinWaitDelay


Mikey
 Share

Recommended Posts

The script below is doing everything I want it to except that it pauses for approximately 15 seconds after line 8. I had tried Opt("WinWaitDelay", 5000), but that didn't work, it wouldn't reduce the fan speed to 65%. I also tried different time settings for WinWait, but nothing changes. Any ideas?

(Thank you ChrisL for the help so far)

1) Run ("M:\PROGRAM FILES\SpeedFan\speedfan.exe")

2) WinWait ( "SpeedFan 4.26" , "" )

3) WinActivate("SpeedFan 4.26", "")

4) Opt("WinWaitDelay", 20000)

5) WinActivate("SpeedFan 4.26", "")

6) ControlFocus ("SpeedFan 4.26", "", "TRxSpinEdit10")

7) ControlClick("SpeedFan 4.26", "", "TRxSpinEdit10")

8) Send("{DOWN 7}")

9) WinWait("SpeedFan 4.26", "")

10) ControlFocus ("SpeedFan 4.26", "", "TJvXPButton2")

11) ControlClick("SpeedFan 4.26", "", "TJvXPButton2")
Link to comment
Share on other sites

Well if its pausing 15 seconds directly after line 8 doesn't that mean that the window doesn't exist for 15 seconds until its passed that line?

Thank you Burrup for the reply. No it doesn't mean that "...the window doesn't exist...", because the window doesn't get minimized til the end of the script. It's still there after line 8, just like when it first ran.

Edited by Mikey
Link to comment
Share on other sites

Put a msgbox after lines 8 and 9. The first should appear straight after line 8 and then the second should appear when the window exists.

I'm probably not explaining this as well as I should. ;) The window always exists throughout this script. Another way of looking at it is this. When line 9 is omitted, the script doesn't pause long enough for line 8 to finish executing, then lines 10 & 11 run, finishing the script. The key is to have the script pause after line 8 so that it finishes.

Link to comment
Share on other sites

Why do you have a WinWaitDelay of 20 seconds? Surely this script will do the same job but quicker:

Run("M:\Program Files\SpeedFan\SpeedFan.exe")
WinWait("SpeedFan 4.26")
WinActivate("SpeedFan 4.26")
WinWaitActive("SpeedFan 4.26")
ControlFocus("SpeedFan 4.26", "", "TRxSpinEdit10")
Send("{DOWN 7}")
ControlFocus("SpeedFan 4.26", "", "TJvXPButton2")
Link to comment
Share on other sites

Hi Alex. Thanx for the input. I tried your code, but the window just hangs. It's true that the 'SpeedFan 4.26' window IS indeed active almost immediately, but it takes 15 - 20 seconds to finish detecting sensors. Again, thank you for taking the time, but the solution Burrup gave me does seem to work quite well.

Link to comment
Share on other sites

I downloaded SpeedFan and checked it out and now I understand why my script wouldn't work -- the window is unresponsive until it reads all the necessary information. I can't find an easy way to figure out when the window becomes fully painted (and thereby responsive to control manipulation), so a Sleep() is probably the best solution after all...

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