Exit all apps
Exit all apps
Hi guys.
Now, is it possible to exit all open apps from one app?
I´m running a slideshow, and during that time it runs (one time information) I can´t seem to be able to stop the script,(only if I loop it) so I started another script at the same time that has the stop code. From that script I should be able to exit all apps, than everything would be fine,
so, is that possible??
SimPlayer
Now, is it possible to exit all open apps from one app?
I´m running a slideshow, and during that time it runs (one time information) I can´t seem to be able to stop the script,(only if I loop it) so I started another script at the same time that has the stop code. From that script I should be able to exit all apps, than everything would be fine,
so, is that possible??
SimPlayer
Re: Exit all apps
Code: Select all
exitAllOpenApps() { ; https://www.autohotkey.com/boards/viewtopic.php?p=462766#p462766
WinGet, winArray, List ; Get all windows
Loop, %winArray% {
WinGet, winStyle, Style, % winTitle := "ahk_id" winArray%A_Index%
WinGetTitle, ttitle, %winTitle%
If (winStyle & 0x10000000 && ttitle) ; Window is visible & has a title
If ttitle not in Program Manager,MainWindow,Start,Windows Task Manager
WinClose, %winTitle%
}
}
Re: Exit all apps
Hi
Thanks man, I´ll give it a try!
SP
Thanks man, I´ll give it a try!
SP
Re: Exit all apps
Hi
Nope, it didn´t work att all, I don´t know if we understand each other this time.
I want to close a specific script by a code line in another script. There´s a post on this but I don´t get that either, viewtopic.php?t=75425
SimPlayer
Nope, it didn´t work att all, I don´t know if we understand each other this time.
I want to close a specific script by a code line in another script. There´s a post on this but I don´t get that either, viewtopic.php?t=75425
SimPlayer
- WalkerOfTheDay
- Posts: 710
- Joined: 24 Mar 2016, 03:01
Re: Exit all apps
Try: (not my code someone gave it to me a couple of year ago, don't know who to credit for it anymore )
Code: Select all
DetectHiddenWindows, On
WinGet, List, List, ahk_class AutoHotkey
Loop %List%
{
WinGet, PID, PID, % "ahk_id " List%A_Index%
If ( PID <> DllCall("GetCurrentProcessId") )
PostMessage,0x111,65405,0,, % "ahk_id " List%A_Index%
}
Re: Exit all apps
What my posted script does:
I added the window class here just as an additional option. This would distinguish this window from others that may have similar window titles.
Closing a specific script is simple in two lines: use WinClose. The window title to specify is the full path to the script. Before the WinClose line, add DetectHiddenWindows, On.From that script I should be able to exit all apps.
Code: Select all
DetectHiddenWindows, On
WinClose, D:\temp2\temp.ahk ahk_class AutoHotkey
Re: Exit all apps
@SimPlayer — When you implemented mikeyww’s code in his first post, did you add a call to that function in your script? If you simply place that function in your script, it doesn’t execute without you adding a call to it.
Re: Exit all apps
Very good point, boiler! Sorry I forgot to mention that specifically.
Re: Exit all apps
Hi
Ok, thanks again guys, I'll give it another try.
SimPlayer
Ok, thanks again guys, I'll give it another try.
SimPlayer