Skip to content

Instantly share code, notes, and snippets.

@rioter00
Last active August 29, 2015 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rioter00/b2da8822883d182462b0 to your computer and use it in GitHub Desktop.
Save rioter00/b2da8822883d182462b0 to your computer and use it in GitHub Desktop.
Applescript for opening and closing applications
on idle
set volume output volume 100 without output muted --100%
set today to weekday of (current date)
set todayTime to time of (current date)
set whichHour to (todayTime / (60 * 60))
if (today = Tuesday) or (today = Wednesday) or (today = Thursday) or (today = Friday) then
if (whichHour > 10) and (whichHour < 17) then
my runApp()
else
killApp()
# return 3600
end if
else if (today = Saturday) then
if (whichHour > 11) and (whichHour < 17) then
my runApp()
else
killApp()
# return 3600
end if
else
killApp()
# return 3600
end if
# return 3600
end idle
-- The open and close functions
on runApp()
tell application "Sandra_Sound"
if it is not running then
activate
--display alert "opened Application"
end if
end tell
end runApp
on killApp()
tell application "Sandra_Sound"
if it is running then
quit
--display alert "closed Application"
end if
end tell
end killApp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment