Jump to content

Help with a Loop


Go to solution Solved by JLogan3o13,

Recommended Posts

Hey guys.

I've got a script designed to wait for a window to pop up and then press the requisite button to get the window to go away. This should be a very easy task to perform, but for some reason I cannot get this script to loop infinitely.  I've tried variations of all of AutoIts Loop commands, but no matter what I try the best I can do is to get it to work just once. What am I doing wrong? Here's the script in it's current iteration.

While True
$win = WinWait("DFX Message", "OK")
    ControlClick($win, "", "[CLASS:Button; INSTANCE:1]")
    WinWaitClose($win)
ContinueLoop
WEnd
 
Thanks,
 
Ardak
Link to comment
Share on other sites

 

Hey guys.

I've got a script designed to wait for a window to pop up and then press the requisite button to get the window to go away. This should be a very easy task to perform, but for some reason I cannot get this script to loop infinitely.  I've tried variations of all of AutoIts Loop commands, but no matter what I try the best I can do is to get it to work just once. What am I doing wrong? Here's the script in it's current iteration.

While True
$win = WinWait("DFX Message", "OK")
    ControlClick($win, "", "[CLASS:Button; INSTANCE:1]")
    WinWaitClose($win)
ContinueLoop
WEnd
 
Thanks,
 
Ardak

 

 

I like to be aggressive with mine.

:alien:

While 1
sleep(90)
winkill("DFX Message", "OK")
WEnd
If @error Then
    MsgBox(262192, "", @ComputerName & " slaps " & @UserName & " around a bit with a large trout!")
EndIf

"Yeah yeah yeah patience, how long will that take?"  -Ed Gruberman

REAL search results  |  SciTE4AutoIt3 Editor Full Version

Link to comment
Share on other sites

  • Moderators
  • Solution

Hi, ardak2000. Try taking the WinWaitClose and the ContinueCase out, and see what that does for you. Also, put in a Debug option at the top of your script so you can see what line the script is hanging on:

Opt("TrayIconDebug", 1)

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

 

Hi, ardak2000. Try taking the WinWaitClose and the ContinueCase out, and see what that does for you. Also, put in a Debug option at the top of your script so you can see what line the script is hanging on:

Opt("TrayIconDebug", 1)

 

holy cow JLogan3o13, that option is going to save me SOOOOO MUCH trouble from here on out, i sure wish i had known about that for the past 4 years instead of putting message boxes everywhere while "debugging" just to see where my script was hanging.

:alien:

If @error Then
    MsgBox(262192, "", @ComputerName & " slaps " & @UserName & " around a bit with a large trout!")
EndIf

"Yeah yeah yeah patience, how long will that take?"  -Ed Gruberman

REAL search results  |  SciTE4AutoIt3 Editor Full Version

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