Jump to content

How can i close all apps that are running with autoit?


Go to solution Solved by Gianni,

Recommended Posts

Posted (edited)

How can i close all apps that are running with autoit?

Sometimes script goes wrong due to other running windows.Therefore i want to close every running windows firstly.

First method

$DELAY = 200
Send("!{F4}")
Send("!{F4}")
Sleep($DELAY)
Send("!{F4}")
Send("!{F4}")
Sleep($DELAY)
Send("{ESc}")

Second

Run("taskmgr.exe")
WinWait("Windows Task Manager","","SysListView321")
ControlSend("Windows Task Manager","","SysListView321","+{DOWN 15}")
sleep(200)
ControlSend("Windows Task Manager","","SysListView321","!e")
Sleep(100)
ControlSend("Windows Task Manager","","SysListView321","!f")
Sleep(100)
ControlSend("Windows Task Manager","","SysListView321","x")

Can anyone help me please???????

Edited by adnanbaloch

Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once."

Posted (edited)

thanks i shall try><<...But i want to close all windows at once.

Edited by adnanbaloch

Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once."

  • Moderators
Posted

But i want to close all windows at once.

That is a subjective statement. Even if you go into Task Manager and select all Programs and choose End, they're not going to all close at exactly the same second.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Posted (edited)

That is a subjective statement. Even if you go into Task Manager and select all Programs and choose End, they're not going to all close at exactly the same second.

i agree but i need a short command like this method.

Run("taskmgr.exe")
WinWait("Windows Task Manager","","SysListView321")
ControlSend("Windows Task Manager","","SysListView321","+{DOWN 15}")
sleep(200)
ControlSend("Windows Task Manager","","SysListView321","!e")
Sleep(100)
ControlSend("Windows Task Manager","","SysListView321","!f")
Sleep(100)
ControlSend("Windows Task Manager","","SysListView321","x")
Edited by adnanbaloch

Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once."

  • Moderators
Posted

 

run this in CMD:

taskkill /?

 

The OP has pointed out that he wants to do all at once (which I don't believe possible). Using Taskkill will be just the same as WinClose or any other method, he'll have to obtain a list and then cycle through it. I am with danwilli, especially knowing the OP's history,  I'm curious why every window needs to be closed at once.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Posted

thanks i shall try><<...But i want to close all windows at once.

 

unplug the power cord of your computer

is the quickest way to stop all of your tasks simultaneously:... :idiot:

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Posted (edited)

unplug the power cord of your computer

is the quickest way to stop all of your tasks simultaneously:... :idiot:

it is a good joke............ha ha ha

Try to help someone instead teasing....But never mind

Edited by adnanbaloch

Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once."

Posted

I have another idea but I'll wait for OP to explain why...

 

What is the purpose of this script?

 

Sometimes script goes wrong due to other running windows.Therefore i want to close every open windows firstly.

Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once."

Posted

CTRL + Break?

i want to close not stop or break.....any way thanks

Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once."

  • Solution
Posted (edited)

it is a good joke............ha ha ha

Try to help someone instead teasing....But never mind

 

ok,

try this: ( a little modification from the autoit help for winlist())

Local $var = WinList()

For $i = 1 To $var[0][0]
    ; Only display visble windows that have a title
    If $var[$i][0] <> "" And IsVisible($var[$i][1]) Then
        WinKill($var[$i][1])
    EndIf
Next

Func IsVisible($handle)
    If BitAND(WinGetState($handle), 2) Then
        Return 1
    Else
        Return 0
    EndIf

EndFunc   ;==>IsVisible

bye

Edited by Pincopanco

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Posted

ok,

try this: ( a little modification frome the autoit help for winlist())

Local $var = WinList()

For $i = 1 To $var[0][0]
    ; Only display visble windows that have a title
    If $var[$i][0] <> "" And IsVisible($var[$i][1]) Then
        WinKill($var[$i][1])
    EndIf
Next

Func IsVisible($handle)
    If BitAND(WinGetState($handle), 2) Then
        Return 1
    Else
        Return 0
    EndIf

EndFunc   ;==>IsVisible

bye

Thank you very very much...............it solved my problem......

Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once."

  • Moderators
Posted

Thank you very very much...............it solved my problem......

 

Using the function I suggested in Post #2. Had you read for yourself and tried it out, instead of waiting to be spoon fed, you'd have been done a lot sooner ;)

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Posted (edited)

Using the function I suggested in Post #2. Had you read for yourself and tried it out, instead of waiting to be spoon fed, you'd have been done a lot sooner ;)

sorry JLogan3o13 sorry i had not enough idea of winlist........you are the first helper for me thank you very much......

Edited by adnanbaloch

Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once."

  • 7 years later...
Posted
On 7/16/2013 at 10:06 AM, Chimp said:

 

ok,

try this: ( a little modification from the autoit help for winlist())

Local $var = WinList()

For $i = 1 To $var[0][0]
    ; Only display visble windows that have a title
    If $var[$i][0] <> "" And IsVisible($var[$i][1]) Then
        WinKill($var[$i][1])
    EndIf
Next

Func IsVisible($handle)
    If BitAND(WinGetState($handle), 2) Then
        Return 1
    Else
        Return 0
    EndIf

EndFunc   ;==>IsVisible

bye

Why the old Windows Shutdown Menu apears (in the middle of the screen) with this? Any idea how not to start it. I can remove it afterwards but its not ideal.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...