Skip to content

Instantly share code, notes, and snippets.

@helmuthauser
Last active August 11, 2018 20:55
Show Gist options
  • Save helmuthauser/78ae6a9415cdeb20492c to your computer and use it in GitHub Desktop.
Save helmuthauser/78ae6a9415cdeb20492c to your computer and use it in GitHub Desktop.
Work Smart and be Remarkable
# Script to prepare the laptop for a presentation
# It switches off all unneccesary applications, mute volume and switches on Caffeine
#
# Make sure you have also switched on "Do not disturb" for
# "when mirroring to TVs and projectors" (in Preferences/Notification)
#
# Latest update: August 3, 2015
# work.smart.and.be.remarkable@gmail.com
# www.helmuthauser.com
set question to display dialog "Ready to switch to presenation mode?" buttons {"Yes", "Cancel"} default button 1
set answer to button returned of question
if answer is equal to "Yes" then
tell application "Dropbox" to quit
tell application "OmniFocus" to quit
tell application "TextExpander" to quit
tell application "Pomodoro Timer" to quit
tell application "nvALT" to quit
tell application "Mail" to quit
# add here your applications that you want to switch off
# if you are not sure about the exact name, start "Activity Monitor" (e.g. search it with Spotlight)
# and look up the "Process Name" (first column) in the list of running processes
# kill Hazel separately, since it does not run as an application
# thanks to Hazel support for their help here
# the script basically looks for the process named "HazelHelper" in the list of running processes
# gets the process ID and stops it
set app_name to "HazelHelper"
set the_pid to (do shell script "ps ax | grep " & (quoted form of app_name) & " | grep -v grep | awk '{print $1}'")
if the_pid is not "" then do shell script ("kill -9 " & the_pid)
#- sound
# Note only mute if you don't use sound for your presentations
set volume with output muted
#- calendar alarms
# switch on
tell application "Caffeine" to activate
# Thanks to Bonnie from http://teachinginhighered.com @bonni208
# The next line makes the script more robust. Now it works with various preference settings.
tell application "Caffeine" to turn on
end if
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment