Jump to content

WinSetState faster & WinExists


n4n0
 Share

Recommended Posts

Hello, currently I have a short code without any pause in-between the loops, but even now the script performs too slow, roughly one second. Is there any way to make it more instantaneous? I tried using If WinExists but I think that is even slower. 

While 1
WinSetState("[CLASS:SplashScreenClassName]", "", @SW_HIDE)
WinSetState("[CLASS:RiotWindowClass]", "", @SW_HIDE)
WEnd

Second question, if I have a code with 

If WinExists(...) Then
statements
EndIf

How can I make statements if the window hasn't existed for a given time, e.g. 60 seconds.

Link to comment
Share on other sites

Link to comment
Share on other sites

How exactly am I supposed to do that? The application is existing for different amount of times (5-30 seconds), but how can I make it to do statements if it hasn't existed in the last 60 seconds? A sample script would be nice.

Link to comment
Share on other sites

Alright, I figured out the second question myself, here's the code:

Local $i = 0

While 1
If WinExists("Proc.exe") Then
    $i = 0
Else
    $i += 1
    Sleep(5000)
EndIf

If $i = 24 Then
    If ProcessExists("Proc2.exe") Then
        ProcessClose("Proc2.exe")
        Sleep(5000)
    EndIf
    Run($Proc2)
EndIf
WEnd

I believe that it can be improved though, any tips?

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