Advertisement
smhdale

H E L P M E

Jul 3rd, 2019
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.54 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Pick a voice
  4. voices=( $(say -v '?' | grep -E 'en_[A-Z]{2}' | cut -d ' ' -f1) )
  5. len=${#voices[@]}
  6. rand=$((RANDOM % $len))
  7. voice=${voices[$rand]}
  8.  
  9. # Osascript strings
  10. vol='(get volume settings)'
  11. set='set volume output'
  12.  
  13. # Save volume and mute
  14. level=$(osascript -e "output volume of $vol")
  15. muted=$(osascript -e "output muted of $vol")
  16.  
  17. # Yell it
  18. osascript -e "$set volume 100"
  19. osascript -e "$set muted false"
  20. say "-v$voice" "help me"
  21.  
  22. # Reset volume & mute
  23. osascript -e "$set volume $level"
  24. osascript -e "$set muted $muted"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement