Sign in to follow this  
Followers 0
Starstar

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

18 posts in this topic

#1 ·  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."

Share this post


Link to post
Share on other sites



Take a look at WinList in the help file to get a list of all open windows. You can then selectively close the ones you would like.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#3 ·  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."

Share this post


Link to post
Share on other sites

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.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#5 ·  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."

Share this post


Link to post
Share on other sites

run this in CMD:

taskkill /?

Share this post


Link to post
Share on other sites

 

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.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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:

3 people like this

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

Share this post


Link to post
Share on other sites

#11 ·  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."

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

CTRL + Break?


[indent=3][/indent]

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

#15 ·  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
1 person likes this

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 ;)

1 person likes this

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#18 ·  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."

Share this post


Link to post
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
Sign in to follow this  
Followers 0