Sign in to follow this  
Followers 0
SorryButImaNewbie

WinExists with timeout

9 posts in this topic

#1 ·  Posted (edited)

Hello!

I read around a bit (not much, helpfile and a quick google search and forum search here), sorry if this has been asked before.

I have a code snippet I wrote:

$Wait = WinExists($TopUpName & ".pdf - Adobe Reader", "", 5)
    If $Wait = 0 Then
       Return
       MsgBox(0, "Title", "Nem találtam")
    Else
       WinClose($TopUpName & ".pdf - Adobe Reader", "")
       MsgBox(0, "Title", "Megtaláltam, szar vagyok és nem zárom be")
    EndIf

Before I used winwaitactive, but I realized that somehow the pdf wasn't neceserry active after it has been opened, so I changed it to WinExists. I saw that there are only 2 parameters for winexists, but when I tried to run it just for the hell of it, It run down without an error. (MsgBox are there just for me too see whats happening)

My question is, whats happening? Does Autoit just skip the last parameter? Is this works as a timeout ? (I doubt that), is there a way to give time out for WinExists? (I'm sure there is) How? :)

Thank you for your time!

Edit:Quick edit for a grammar mistake

Edited by SorryButImaNewbie

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

Thanks Master @JohnOne!

Yeah now that you say,I think I would be better with simply using WinWait, but what happens in the backround in the above case? Does Autoit just ignore the 3. parameter, because there can't be a third?

(Changed to WinWait)

Edited by SorryButImaNewbie

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Yeah but in the 1. post ,in the code, there are 3 parameters (variable + string, and empty one, and a number) and it runs without any error that I can see.

I thought when I started to run it that it wont even execute, but it did

Edited by SorryButImaNewbie

Share this post


Link to post
Share on other sites

OK, I see, and am unsure of the answer, unless it's been discussed before only a code dev would know that.

I too would have expected it to give a "wrong number of parameters" error.

There are a few possible answers, but they'd all be guesses from someone who does not have access to the AutoIt3 source code.


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

I expected the same, interesting 0.o

Share this post


Link to post
Share on other sites

I got the same results as J1.


Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

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
Sign in to follow this  
Followers 0