# TO DO
# https://superuser.com/questions/688024/how-can-i-determine-if-an-application-is-not-responding
# Check For Process With Schedule
# File > Export
# File format: Application
# Options: Stay open after run handler
# Notes
# Words like 'path' are reserved.
# To designate them as variables you surround them with ||
global checkList, wakeHour, sleepHour
on run
#Declarations
set calculator to {process:"Calculator", |path|:"Stuff:Applications:Calculator"}
set calendar to {process:"Calendar", |path|:"Stuff:Applications:Calendar"}
set checkList to {calculator, calendar}
set wakeHour to 9
set sleepHour to 21
#Logic
delay 5
tell application "Finder"
set bootApp to |path| of (item 1 of checkList)
open file bootApp
end tell
end run
on idle
delay 5
set hoursNow to hours of (get current date)
if (hoursNow > wakeHour) and (hoursNow < sleepHour) then
tell application "Finder"
repeat with checkItem in checkList
if not (process (|process| of checkItem) exists) then
open file (|path| of checkItem)
end if
delay 5
end repeat
end tell
end if
return 1
end idle