Jump to content

Different between Exit and WinKill


Recommended Posts

Hello dear readers!

This is just an enquiry about the 2 commands from the title

What I want to know that other then the outcome (that both can possibly used to close a program) what are the differences? WinKill can of course be used to close windows not just programms, like Exit. I know the WinKill is more like a forced close, but what does that actually means? I'm just curious what you guys use WinKill for generally? I use it to close some popup windows in my script, is that a good idea? or you suggest something else?

Thank you

Link to comment
Share on other sites

Exit    

Terminates the script.

Exit [return code]

 

do you mean WinKill and WinClose?

If @error Then
    MsgBox(262192, "", @ComputerName & " slaps " & @UserName & " around a bit with a large trout!")
EndIf

"Yeah yeah yeah patience, how long will that take?"  -Ed Gruberman

REAL search results  |  SciTE4AutoIt3 Editor Full Version

Link to comment
Share on other sites

my point is that Exit does not close programs or windows, it ONLY terminates the script.

If @error Then
    MsgBox(262192, "", @ComputerName & " slaps " & @UserName & " around a bit with a large trout!")
EndIf

"Yeah yeah yeah patience, how long will that take?"  -Ed Gruberman

REAL search results  |  SciTE4AutoIt3 Editor Full Version

Link to comment
Share on other sites

Yes, But if you have a GUI in your script, it can be done in a way that a WinKill terminates the script as well, I guess however that explanation of the difference between WinKill/WinClose would be more usefull to me. 

I get your point but dont see how it is relavent, as terminating the script closes its window, so I think they are at least somewhat similar, (not as similar as WinClose and WinKill so I agree that it would have been a better question for this thread)

Link to comment
Share on other sites

with WinClose(), if the window or program that you close needs further interaction, such as a "would you like to save changes" , then the dialog will popup waiting for you.

with WinKill(), it will close the window or program without asking you to save changes, so no popups or anything else keeping the window from closing (force close)

another way to force close a program is ProcessClose(), which i use if i need to kill a program that has multiple windows without having to close each window separately.

:alien:

If @error Then
    MsgBox(262192, "", @ComputerName & " slaps " & @UserName & " around a bit with a large trout!")
EndIf

"Yeah yeah yeah patience, how long will that take?"  -Ed Gruberman

REAL search results  |  SciTE4AutoIt3 Editor Full Version

Link to comment
Share on other sites

Thank you (actually the main reason why I asked because I saw that a function of mine which was wrote to exit from a program used winkill, I figured that it isn't the best solution, so after a bit of digging I changed it to work with ProcessClose(), but also it lead me to start and ask this question so I also learn something :) )

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...