SorryButImaNewbie Posted April 15, 2015 Share Posted April 15, 2015 (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 April 15, 2015 by SorryButImaNewbie Link to comment Share on other sites More sharing options...
JohnOne Posted April 15, 2015 Share Posted April 15, 2015 That function just tests if the window exists at the time of calling. There is no ambiguity there, you're probably looking for WinWait. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
SorryButImaNewbie Posted April 15, 2015 Author Share Posted April 15, 2015 (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 April 15, 2015 by SorryButImaNewbie Link to comment Share on other sites More sharing options...
JohnOne Posted April 15, 2015 Share Posted April 15, 2015 I'm not sure I understand, WinExists only takes 2 parameters, title of window, and text of window. there is no 3rd. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
SorryButImaNewbie Posted April 15, 2015 Author Share Posted April 15, 2015 (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 April 15, 2015 by SorryButImaNewbie Link to comment Share on other sites More sharing options...
JohnOne Posted April 15, 2015 Share Posted April 15, 2015 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. Link to comment Share on other sites More sharing options...
JohnOne Posted April 15, 2015 Share Posted April 15, 2015 Actually. WinExists("somebullshitnamethatdoesnotexist", "samewithtext", 3) error: WinExists() [built-in] called with wrong number of args. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
SorryButImaNewbie Posted April 15, 2015 Author Share Posted April 15, 2015 I expected the same, interesting 0.o Link to comment Share on other sites More sharing options...
MikahS Posted April 15, 2015 Share Posted April 15, 2015 I got the same results as J1. Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy 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 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now