n4n0

WinSetState faster & WinExists

5 posts in this topic

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.

Share this post


Link to post
Share on other sites



Second question answer. Use WinWait instead.

Saludos


 

venezuela.png Would you like to say thank to Danyfirex using a warmy way?  offer me a cup of coffee... coffee.png

autoit_scripter_blue_userbar.png

       AutoIt...

 

 

Share this post


Link to post
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.

Share this post


Link to post
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?

Share this post


Link to post
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