Macos veya Apple için Tüm uygulamaları kapat ve sonrasında oturumdan çıkış yapan script kodu

tell application "System Events"
	set visibleApps to name of every process whose visible is true
end tell

repeat with appName in visibleApps
	try
		tell application appName to quit
	on error errorMessage
		display dialog ("Couldn't quit " & appName & ": " & errorMessage)
	end try
end repeat

tell application "System Events"
	log out
end tell

delay 2 -- Wait for 2 seconds to ensure logout has occurred

tell application "System Events" to sleep

Eğer sadece uygulamalardan çıkış yapsın istiyorsanız aşağıdaki kodu kullanın

tell application "System Events"
	set visibleApps to name of every process whose visible is true
end tell

repeat with appName in visibleApps
	try
		tell application appName to quit
	on error errorMessage
		display dialog ("Couldn't quit " & appName & ": " & errorMessage)
	end try
end repeat