Jump to content

Execute by time lapse?


Recommended Posts

I am trying to write a script that will run by what the title of the window says.

So lets say the window has a title for a couple of seconds, everythign is running fine, so I don't want the script to interfeere. But if the title is the same for more then 5 seconds, I want the script to run, its just a simple mouseclick.

And I just can't figure out the loop. i looked the For, etc. commands.

So how can I make the script run over and over?

Thx for any help. :lmao:

Link to comment
Share on other sites

Welcome,

Maybe something like this will help? It will wait for a window title, if one exists at any time, it will then sleep for 5 seconds. If the window exists still, it will make it will activate, then do the action of the mouseclick. Then the loop restarts over.

Usage of the text parameter in the window functions can help, pinpoint, exactly the windows to process, rather then any with the same title. You can replace the 'Title' string used with your own, and the mouseclick is left clicking at coordinates 200,300. Just change to suit your needs.

While 1
    WinWait('Title')
    Sleep(5000)
    If WinExists('Title') Then
        WinActivate('Title')
        If WinActive('Title') Then
            MouseClick('left', 200, 300)
        EndIf
    EndIf
WEnd

Would suggest that you look at ControlClick in the helpfile. This could replace MouseClick and the window activation would not be needed.

:lmao:

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