Jump to content

Recommended Posts

Posted

Hello, I'm new in this forums and with AutoIt :)

I want to create a loop that repeats the same function every 10 minutes, during the existence of a Window and, when the window be closed, stop the loop.

¿This is posible?

I tried doing this, but don't work ;)

If WinExists("WindowName, """) Then
$window = 1 Else
    $window = 0
    EndIf
While $window = 1
    Sleep(600000)
    MouseClick("left", 93, 350, 1, 15)
    WEnd

Thanks, and sorry for my bad english.

Posted

Hello, I'm new in this forums and with AutoIt :)

I want to create a loop that repeats the same function every 10 minutes, during the existence of a Window and, when the window be closed, stop the loop.

¿This is posible?

I tried doing this, but don't work ;)

If WinExists("WindowName, """) Then
$window = 1 Else
    $window = 0
    EndIf
While $window = 1
    Sleep(600000)
    MouseClick("left", 93, 350, 1, 15)
    WEnd

Thanks, and sorry for my bad english.

You got an infinite loop there. You see, you are not modifying the value of $window inside the loop. Your script could be reduced to this:

While WinExists("WindowName")
    Sleep(600000)
    MouseClick("left", 93, 350, 1, 15)
WEnd

Or..

AdlibEnable("_CheckWindow",600000)

While 1
    Sleep(100)
WEnd

Func _CheckWindow
    If WinExists("WindowName") Then
        MouseClick("left", 93, 350, 1, 15)
    EndIf
WEnd

You should totally follow Smoke's advice. Autoit 1-2-3 is awesome.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...