Jump to content

If NOT WinExists("blah") then


Recommended Posts

Well, I'm gonna try to submit my first UDF here... :D (I tried the PixelSet idea a while ago but I didn't even read anything in the post - therefor, making myself look like a fool :">) And I was doing a statement like this:

If NOT WinExists(WinGetHandle("Windows Media Player")) then
MsgBox(16, "lalal", "akjsfjaksf")
Return 0
EndIf

Then, I exited out of Windows Media Player, completley, and tried running the above, and I didn't get the msgbox or anything... But here is my full code, where everything works except for the above...

Func _WinFlash($hWnd, $i_Delay = 500, $i_Flashes = 2);Thanks to Larry and JdeB
   Local $h_Wnd, $h_Dll, $i_Flashes, $i_Flashes, $i_Int
   If NOT WinExists(WinGetTitle($hWnd)) then 
       MsgBox(16, "_WinFlash Error", "Error! The window handle provided may not exist!")
       Return 0
   EndIf
   If $i_Delay < 1 then 
       MsgBox(16, "_WinFlash Error", "Error! You supplied an unacceptable time to delay!")
       Return 0
   EndIf
   If $i_Flashes < 1 Then
       MsgBox(16, "_WinFlash Error", "Error! You supplied an unacceptable amout of flashes!")
       Return 0
   EndIf
   For $i_Int = 1 To $i_Flashes
      DllCall($h_Dll, "int", "FlashWindow", "hWnd", $h_Wnd, "int", 1)
      Sleep($i_Delay)
   Next
   DllClose($h_Dll)
EndFunc  ;==>_WinFlash

Any ideas on why that If NOT WinExis... part doesn't work?

Thanks a bunch! :)

FootbaG
Link to comment
Share on other sites

Any ideas on why that If NOT WinExis... part doesn't work?

Thanks a bunch!  :D

<{POST_SNAPBACK}>

Perhaps because you are using a handle as the parameter, rather then the title. :)

WinExists ( "title" [, "text"] )
title  The title of the window to check.
Link to comment
Share on other sites

But looky here :D :

If NOT WinExists(WinGetTitle($hWnd)) then

I am getting the title in WinExists, does that qualify? Please verify :) ...

Because it's still not working... :D

Edited by layer
FootbaG
Link to comment
Share on other sites

layer, is simple logic beyond you? You come up with some of the dumbest looking code because you try some asinine, obscure, overly complex method to get something done instead of just the simple thing.

If NOT WinExists(WinGetTitle($hWnd)) then

What the hell do you have to be on to write something like that? Doesn't your brain ever go, "Man, that looks dumb, that can't be right"? Can you not see the connection that maybe you should just use the HWND in WinExists() instead of doing that WinGetTitle() crap?

After the experience of seeing you try to write both AutoIt and C++, I beseech you to either give up on programming/scripting entirely or to realize that if you want to be anything more than an annoyance to people, you are going to have to spend massive amounts of time reading how to do things (And comprehending what you read). If you are not prepared to invest time, then this is not something you will ever be good at, period. I don't really care what route you take, but you must decide one way or the other or you are wasting your own time and everyone else who you pester for help with the dumbest things.

You may not like me or the things I say or how I say them, but that does not mean I am wrong. I have successfully taught myself C++, AutoIt, the Windows API, COM, and a few other bits and pieces of various scripting languages all within the last 2 years. I didn't do it assing around and asking questions on forums and ignoring the answers. I did it by reading at least 6 books that I can recall and countless articles and tutorials (After first learning the foundation of the language, of course).

Link to comment
Share on other sites

No, really, I've gotten a lot further then I ever wanted to get. The only thing I ever wanted to created was a messagebox, and when I did, I didn't even know it was called a messagebox. And I don't like to read books, I'll read newspapers, your posts, or anyones posts, but books, just I hate them. And since I know I'm not going to be programming/scripting on the computer once I get my girlfriend problems worked out, and I'm 18 and join the Fire Dept. Because the only reason I actually script, is becuase I don't have anything else better to do, my parents are always at work and because I can't drive yet (2 more years...), and where I live, it's not the city, it's the woods, so I can't just walk into town and let the AutoIt forums alone. I'm not trying to be a pain in the ass, and I'm not trying to be like you, which is basically what you always tell me. You always give me these long ass excerpts about why I suck, why I should drop it all and give up, how I'm not the computer god. Well the truth is, I don't want to be the computer god, and I'm not aiming to be like you. I script the way I want to script and thats final. Now if YOU don't like it, then leave me alone. I don't need you to survive, and that's what your acting like now. And by the way, I'm proud to say that half the vocab. up in your book in your last post, I didn't understand. There! Live with it! I don't care what you want me to be like, so quit telling me to change, because I aint gonna change for you... If you really want me to leave, then, well, uhhhhh, what was it again, um, wait, one second, hang on, I think I got it! Too bad :D Good night, can't wait to see if you post to this tomorrow :)

Edited by layer
FootbaG
Link to comment
Share on other sites

If you wish to do things your way, thats fine. What I ask then is you leave us out of it. Don't ask us (meaning the forum) for help. If you don't want to learn the language, don't bother us. Let the people who answer questions spend their time helping people who it will actually benefit instead of you who it won't. Don't stick your nose into threads in which you don't understand whats going on (You've done this a lot lately).

If you want to do things your way, do them your way meaning nobody else is involved but you. That should make you happy as well as all the forum-goers tired of reading your posts. Its win-win.

Link to comment
Share on other sites

Well, thanks for understanding. But I'm stubborn and I'll continue to ask questions and learn... If you really think I haven't learned anything, you're crazy. I've learned a lot...

FootbaG
Link to comment
Share on other sites

Always have time to help you Layer. :D

Your appreciation to learn the Autoit language is enough to qualify, for help in this forum.

Valik is acting like a self-defined, distastefully arrogant individual as always. :)

Just as well, Layer, that you do not want to be like Valik. Else you would have more fingers on your hand, rather then friends. :D

Link to comment
Share on other sites

Well, thanks for understanding. But I'm stubborn and I'll continue to ask questions and learn... If you really think I haven't learned anything, you're crazy. I've learned a lot...

<{POST_SNAPBACK}>

You're right, you are stubborn. The problem is, you've also been stubborn about learning, too. Have you learned something? Yes. But you haven't learned nearly as much as you've been offered. You seem to have a problem listening to people, particularly me. Apparently it is more important to you who the advice comes from instead of what it is. You don't seem to listen to anything I say on principal more than anything else.

Always have time to help you Layer. :D

Your appreciation to learn the Autoit language is enough to qualify, for help in this forum.

Valik is acting like a self-defined, distastefully arrogant individual as always. :)

Just as well, Layer, that you do not want to be like Valik. Else you would have more fingers on your hand, rather then friends. :D

<{POST_SNAPBACK}>

MHz, I have to say, layer is acting more mature in this thread than this outburst from you. I don't see any relevance at all to the quantity of one's friends and the subject being discussed. Is this some feeble attempt at a joke or insult? It seems an immature personal attack that falls a little short because of the choice of subject matter. Perhaps the quantity of friends is not quite as important as the quality of the friends a person has.
Link to comment
Share on other sites

Valik is just being honest (and probably always is). And so should everyone.

To quote Valik:

<{POST_SNAPBACK}>

I am being honest and straight forward in saying that Valik is an insultive person at best.

People ask for help, not for his insults, and no one deserves this insultive behavior.

Total posts for Valik, would be well above 50% of insulting, critical posts. Not a bad effort.

Now that is the facts. :)

Link to comment
Share on other sites

I am being honest and straight forward in saying that Valik is an insultive person at best.

People ask for help, not for his insults, and no one deserves this insultive behavior.

Total posts for Valik, would be well above 50% of insulting, critical posts. Not a bad effort.

Now that is the facts.  :)

<{POST_SNAPBACK}>

I suggest you look at what is being said, not how its being said. Its the content that matters, not the presentation. Those who don't have a problem with me have learned to see past the crude methods I use and see the actual content of my posts.

You've gotten so hung up on how I said what I said to layer that you didn't actually pay attention to what I said. That, however, doesn't make the things I said any less true or any less relevant.

Link to comment
Share on other sites

Valik is just being honest (and probably always is). And so should everyone.

To quote Valik:

<{POST_SNAPBACK}>

Honesty is one thing.

Tact is another.

"Sweet, tasty bullshit" is a third.

Don't confuse tactful honesty with "sweet, tasty bullshit".

Valik has all the tact of a titanium jacketed depleted uranium Abrams tank round....and that's no bullshit.

Edited by Blue_Drache

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Link to comment
Share on other sites

<{POST_SNAPBACK}>

Honesty is one thing. 

Tact is another. 

"Sweet, tasty bullshit" is a third. 

Don't confuse tactful honesty with "sweet, tasty bullshit".

Valik has all the tact of a titanium jacketed depleted uranium Abrams tank round....and that's no bullshit.

<{POST_SNAPBACK}>

Very nice.

I would like to point out, though, that adding tact to an unpleasant truth often produces quizzical looks and unclear meaning. If the meaning is going to end up becoming unclear, nothing should be said to begin with. Therefore, I generally avoid being tactful and just say what I have to say and avoid all the candy-coated confusion.

Edit: Fixed quoting mistake (that the forum made?).

Edited by Valik
Link to comment
Share on other sites

Sorry to bring this topic back up. (If the mods want, they can move it to chat :) ) But most people I think are afraid to say what they think to valik. That's why I see so many people suck up to him. Ok, so he's being honest, and so am I, what's the difference? Presentation doesn't matter anyways... Right? The only thing I asked for is help on this problem. Not whether I should quit programming or scripting. So why are you being a hypocrite valik? Please explain. Because according to you, I've been saying things in other peoples post, but I don't know what I'm talking about? According to you:

Don't stick your nose into threads in which you don't understand whats going on (You've done this a lot lately).

Ok... And what are you doing now? I didn't ask for your personal opinion on whether or not I should quite scripting, I asked for some help with my above code... So really, now you're sticking your nose into other peoples threads (specifically mine) and assume YOU know what's going on... :D
FootbaG
Link to comment
Share on other sites

Sorry to bring this topic back up. (If the mods want, they can move it to chat :) ) But most people I think are afraid to say what they think to valik. That's why I see so many people suck up to him. Ok, so he's being honest, and so am I, what's the difference? Presentation doesn't matter anyways... Right? The only thing I asked for is help on this problem. Not whether I should quit programming or scripting. So why are you being a hypocrite valik? Please explain. Because according to you, I've been saying things in other peoples post, but I don't know what I'm talking about? According to you:

Here is an example of you "helping" somebody on a subject you know nothing about: link

This particular comment is should be absurd to most people: link

Unfortunately, I don't recall some other goodies at the moment.

Ok... And what are you doing now? I didn't ask for your personal opinion on whether or not I should quite scripting, I asked for some help with my above code... So really, now you're sticking your nose into other peoples threads (specifically mine) and assume YOU know what's going on... :D

We all know your exploits to learn C++. I have this comment which shows you wanting to learn COM. You obviously do want to learn something, despite your rambling speech about how you don't want to be a "computer god". There is a difference, however, between devoting enormous amounts of time to become a "computer god" and at least learning the damn basics of the language. You've been here on the forum since October. You should not be writing stupid code like you did in this thread. Even if you don't devote any more time than you currently do, you could at least maximize what you do with your time so that you can avoid basic questions like this after almost 5 freaking months.

So, the way I see it, you've been at it long enough to be pretty good, but you aren't. A lot of it seems that you don't actually listen to people when they answer your questions. When that happens, your presence begins to affect everybody. When you're making posts trying to help people by giving them incorrect information, you're being counter-productive in the help process. When you post a question and don't actually try to understand the answers you get or you refuse to take the advice of people who are clearly more experienced than you, then you've just caused that person to waste their time (Much like I'm doing right now replying to you since I appear to be towards the top of your "Don't do anything this person says" list). Maybe if you'd only been here a couple weeks, it'd be more tolerable. But it's been almost 5 months. There is no excuse to still be a total amateur after 5 months. You've been given plenty of help and plenty of advice so that you can stand on your own two legs in the language and you've thus far failed to do so. I'm not saying you have to write a new version of CyberSlug's GUI Builder 5 months after joining the forum, but you could at least not be making stupid mistakes like in this thread.

Link to comment
Share on other sites

That's because I'm more of a hands-on learner. It's hard for me to learn stuff over the internet :D Ok, soe enough about me, whatever, but AT LEAST admit to bugging into this topic with the wrong advice for the wrong question... Damn, I may write more tomorrow, my hands are tired from the last post, how do you do it, Mr. ComputerGod?

EDIT: But on the first link you supplied with blackmail bout' me, notice how I said I haven't tested this yet? :)

EDIT2: Since this seems to be the stupid questions asked by layer topic, can I ask you a question? Is it possible to create a GUI window with the API "CreateWindowEx" ? I know you can in C++, but I can't seem to get a GUI with it... I've gotten a button with a border just like a GUI but the button is as big as the window... Doesn't really count :D

Edited by layer
FootbaG
Link to comment
Share on other sites

That's because I'm more of a hands-on learner. It's hard for me to learn stuff over the internet :D

Then why do you ask questions on forums? That goes back to my amended suggestion. If you insist on not investing the proper amount of time and effort to do it right and you're not going to quit, then don't bother us on the forum with support requests when they aren't going to help you.

Ok, soe enough about me, whatever, but AT LEAST admit to bugging into this topic with the wrong advice for the wrong question...

Attempting to get someone to either try to learn for themself or stop altogether supercedes answering a specific question. If you actually learn the language, you will have fewer questions, therefore, that's a more important than answering a small-potatoes specific question. As I stated before, I don't care if you learn the language or give up. I'm not diametrically opposed to you staying and learning the language, I only want to see an end to the stupid questions you ask about AutoIt and the other comments you make in threads in which you don't actually understand the subject(s) being discussed.

Damn, I may write more tomorrow, my hands are tired from the last post, how do you do it, Mr. ComputerGod?

Using computers for a decade or something, perhaps?

EDIT: But on the first link you supplied with blackmail bout' me, notice how I said I haven't tested this yet?  :)

Saying something is untested doesn't automatically imply "I have no clue what I'm talking about because I've never even used this kind of stuff before". Knowing whether or not somebody has a general idea what they are talking about before taking their advice is a good thing to know. Its one thing to make an educated guess at something. It's another thing entirely to throw out a wild guess when there are more qualified people around who can actually answer the question.

EDIT2: Since this seems to be the stupid questions asked by layer topic, can I ask you a question? Is it possible to create a GUI window with the API "CreateWindowEx" ? I know you can in C++, but I can't seem to get a GUI with it... I've gotten a button with a border just like a GUI but the button is as big as the window... Doesn't really count :D

Yes, CreateWindowEx() is DllCall-able provided you know how to use it in the first place. I can't imagine it being terribly useful, however, since there will be no way to handle any events from within AutoIt.
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...