Jump to content

Possible bug in WinKill?


Recommended Posts

Well, I was making this program which will terminate Windows Explorer as soon as there's "System" in the title of the window. However, it seems that WinKill-ing windows that use explorer.exe is quite impossible. All I get when attempting to do so results in nothing more than a polite popupbox sound and no reaction to the WinKill. Any other windows will be killed nonetheless.

Any incredibly simple thing I'm forgetting, or should this one move over to the bugs section?

It might even be some kind of Windows security precaution.

Two notes: WinClose with exactly the same title name works as it should, and for anyone wanting to see the code:

WinKill("\System")

Rest of the code doesn't matter I believe, except the Opt("WinTitleMatchMode", 2)

Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Link to comment
Share on other sites

If you are wanting to close just a window why not just use WinClose.

And by the way correct me if im wrong but doesnt WinKill close the process the window belongs to?

Edit: Just took a look at WinKill in the help file and noticed this bit of text: "Although WinKill can work on both minimized and hidden windows, some windows (notably explorer windows) can only be terminated using WinClose."

Edited by Emperor
Link to comment
Share on other sites

Yes you're right :"> I really thought I'd looked it up, guess I accidentally looked WinClose.

Tnx

Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Link to comment
Share on other sites

Well, I was making this program which will terminate Windows Explorer as soon as there's "System" in the title of the window. However, it seems that WinKill-ing windows that use explorer.exe is quite impossible. All I get when attempting to do so results in nothing more than a polite popupbox sound and no reaction to the WinKill. Any other windows will be killed nonetheless.

Any incredibly simple thing I'm forgetting, or should this one move over to the bugs section?

It might even be some kind of Windows security precaution.

Two notes: WinClose with exactly the same title name works as it should, and for anyone wanting to see the code:

WinKill("\System")

Rest of the code doesn't matter I believe, except the Opt("WinTitleMatchMode", 2)

It is perhaps not a bug but I did a small correction in 3.1.1.127 to avoid this discrepancy.

Thanks :D

Link to comment
Share on other sites

It seems that it would be desired behaviour to have WinKill incorporate the functionality of WinClose. Where WinKill will perform WinClose() then WinKill. I think...

Lar.

I did that man
Link to comment
Share on other sites

  • Moderators

sweeet... I love you JP. ( just having a male bonding moment. men don't say I love you enough. )

Lar.

You're still not getting his BudLight! :D

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

It seems that it would be desired behaviour to have WinKill incorporate the functionality of WinClose. Where WinKill will perform WinClose() then WinKill. I think...

Lar.

WinKill() should actually do WinKill functionality then WinClose. The idea is to force the window closed first and if that fails, try a less agressive approach just to try and get something done. Making WinClose behavior first may have negative, script-breaking effects and should be avoided. The general function flow should be:

If WindowExists() Then KillWindow()
Sleep(WinWaitDelay)
If WindowExists() Then  CloseWindow()
Link to comment
Share on other sites

WinKill() should actually do WinKill functionality then WinClose. The idea is to force the window closed first and if that fails, try a less agressive approach just to try and get something done. Making WinClose behavior first may have negative, script-breaking effects and should be avoided. The general function flow should be:

If WindowExists() Then KillWindow()
Sleep(WinWaitDelay)
If WindowExists() Then  CloseWindow()
I suppose you have look at the code. It is trying to close with a special function and then really kill if needed.

I don't really understand why this first closong is not working so calling the same function as in winclose is something which can be done without breaking scripts.

It appear only windows created by explorer.exe it is this strange behavior.

Link to comment
Share on other sites

I suppose you have look at the code. It is trying to close with a special function and then really kill if needed.

I don't really understand why this first closong is not working so calling the same function as in winclose is something which can be done without breaking scripts.

It appear only windows created by explorer.exe it is this strange behavior.

I just looked a the code. IMO, we should ask Jon why the code for WinKill() is the way it is. I don't understand why Jon didn't just use similar logic to WinClose() to begin with. In general, if the code doesn't make sense, it's best to ask the author why it doesn't make sense instead of just blindly changing it.
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...