Making VoiceOver announce the time and date on your Mac

This is an updated and refined version of this guide, now that I've learned a little more, and stopped being so confused.

So we all know about the keyboard commander, and how you can make it read the time when you press option + t, but I personally find that method really really slow. In addition, for me at least, the date doesn't even read some times. So I set to making my own solution.

So, if you've got VoiceOver controllable by Applescript (in the General tab), you can make it say stuff etc.

Note: The reason this is v2 of this guide, is the following run from AppleScript editor, although working, will not work...

tell application "voiceover" to output "Hello world."

This is because AppleScript editor makes VoiceOver say "Run", after the script has been executed, thus you don't hear what you told VoiceOver to say.

Anyways, here's my updated time script, which you just need to point a keyboard command, quicknav key, or any other trigger of your choosing towards:

tell application "VoiceOver" to output (do shell script "date +\"%d %h %Y, %H %M %S\"")

In addition, as a bonus for me being so stupid and not getting VoiceOver to talk before, here's my other scripts:

Battery.scpt:
tell application "VoiceOver" to output (do shell script "pmset -g batt")

Disk Usage.scpt:
tell application "VoiceOver" to output (do shell script "df -h | head -2 | tail -1")

Date Reader.scpt:
tell application "VoiceOver" to output (do shell script "date +\"%d %h %Y, %H %M %S\"")

Memory.scpt:
tell application "VoiceOver" to output (do shell script "memory_pressure | grep \"memory free\"")

Ping.scpt:
tell application "VoiceOver" to output (do shell script "if ping -c1 bbc.co.uk > /dev/null;
then msg=\"up\";
else msg=\"down\";
fi;
echo \"Net is $msg\"")

Note: You have to send ping's output to /dev/null (nowhere), otherwise VoiceOver reads all that too.

Enjoy, and happy hacking.

Tags: 

Disclaimer

The guide on this page has generously been submitted by a member of the AppleVis community. As AppleVis is a community-powered website, we make no guarantee, either express or implied, of the accuracy or completeness of the information contained in this guide.

1 Comment

#1 Making VoiceOver announce the time and date on your Mac - Revise

I like Chris's scripts so much that I spent some time to add a bit of filtering to the output so I get the most important info. Chris, I hope you do not mind my steeling and revising your great work!

To use these scripts, as Chris explains in the original post, use the Script Editor to cut / paste each of these into a separate file. Then use the VoiceOver Utility's Keyboard Commander to assign keystrokes to each of these AppleScripts.

If you wish to extend or change these scripts, note that the bulk of the work is done by the UNIX shell scripting embedded in the VoiceOver output command (date, grep, cut, memory_pressure, etc.). If you know shell script, you can enhance / come up with other useful scripts to create.

-- Time of Day
tell application "VoiceOver" to output (do shell script "date +\"%l %M %p, %A %d %h %Y\"")
-- Example result: 3:47 PM, Sunday 18 September 2016
-- Google the UNIX date syntax to learn the meaning of the various %x items if you want to change the output.

-- Battery Status
tell application "VoiceOver"
output (do shell script "pmset -g batt | grep InternalBattery | cut -d ' ' -f 3-4")
delay 1
output (do shell script "pmset -g batt | grep drawing | cut -d ' ' -f 4-")
end tell
-- Example result: 61%, Discharging, Battery Power

-- Disk Free
tell application "VoiceOver"
output (do shell script "df -h | head -2 | tail -1 | tr -s ' ' | cut -d ' ' -f 4")
end tell
-- Example result: 122Gi
-- read this as 122G; not sure why the i is appended...

-- Working memory free%
tell application "VoiceOver"
output (do shell script "memory_pressure | grep \"memory free\" | cut -d ' ' -f 5")
end tell
-- Example result: 58%

Hope you find this useful...