Guest User

Untitled

a guest
May 24th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. #!/bin/bash
  2. # Run this script just before you put the laptop in the bin for security scanning.
  3. # You can add the seconds the laptop will be waiting before speaking. The default
  4. # is waiting for 180 seconds (3 minutes).
  5.  
  6. # Switch to the login screen, effectively locking the screen.
  7. function lockscreen() {
  8. /System/Library/CoreServices/"Menu Extras"/User.menu/Contents/Resources/CGSession -suspend
  9. }
  10.  
  11. function voice() {
  12. echo "Locking screen now..."
  13. sleep 1; lockscreen
  14. sleep $1; echo "Hit Ctrl-C to interrupt the voices."
  15. osascript -e "set Volume 10"
  16. while :; do
  17. # You could be creative here!
  18. sleep 5; say -v Bell -r 50 dong dong
  19. sleep 1; say -v Victoria -r 100 "I don't belong to you"
  20. done
  21. }
  22.  
  23. function volume_off() {
  24. osascript -e "set Volume 0"
  25. echo; echo "Turned volume off."
  26. exit
  27. }
  28.  
  29. trap volume_off INT
  30. wait=$1
  31. if [[ $# -lt 1 ]]; then wait=180; fi
  32. echo "Caffeinated. Waiting $wait seconds then starting voice..."
  33. caffeinate -i & voice $wait
  34.  
  35. # caffeinate doesn't always work. InsomniaX seems to interfere.
  36. # In such a case you have to disable sleep manually.
Add Comment
Please, Sign In to add comment