(*
*)
property interval_seconds : 60 --
--
property excludeApp_list : {"Finder", "Safari", "firefox-bin"}
--
--
property hideApp_list : {}
global button_result
on run
set hideApp_list to my hideApp()
end run
on idle
delay (interval_seconds - 5)
set hideApp_list_now to my hideApp()
repeat with eachApp in hideApp_list_now
if (hideApp_list does not contain eachApp) and (excludeApp_list does not contain eachApp) then
my show_alert(eachApp & " を終了しますか?", "", critical, {"Cancel", "Quit"}, 2)
if button_result is "Quit" then my quitApp(eachApp)
end if
end repeat
delay 5
set hideApp_list to my hideApp()
end idle
on hideApp()
tell application "System Events"
set processList to name of every application process whose background only is false and visible is false
end tell
return processList
end hideApp
on quitApp(appName)
try
tell application appName to quit
end try
end quitApp
on show_alert(alert_text, message_text, alert_icon, button_list, default_button)
--
tell me
activate
display alert (alert_text as Unicode text) message (message_text as Unicode text) as alert_icon buttons button_list default button default_button
set button_result to button returned of result
end tell
end show_alert