A simple script for Safari “not responding” issue

By Brian, 4 September, 2023

Forum
macOS and Mac Apps

Disclaimer: I am up way too early this morning. 🥺

As many of us are having issues with Safari and VoiceOver on the latest iterations of macOS (see: Past 5 years) I wrote up a small script (see: Extremely basic) that may be of some use.
What it does:

In a nutshell, it toggles off VO, then opens Safari. It will speak aloud "Safari" just to simulate VO if you were, say, to click on the Safari dock icon to open it. Once Safari loads the focus is placed on Safari, and then VO re-engages.

What it does not do:

Make your life better. Make you a cup of coffee. Give you a foot rub, or pat you on the back and say, "Good job".

However, maybe it will help get around the annoying "Safari not responding" issue. Code is below. Just copy/paste it into Script Editor and save it as whatever's clever.

# Begin script

tell application "System Events"
key code 96 using {command down}

say "Safari." using "Samantha" speaking rate 265 volume 0.85
tell application "Safari" to activate

end tell
tell application "System Events"
key code 96 using {command down}
end tell

# End script

HTH. 😃

Options

Comments

By Brian on Tuesday, September 26, 2023 - 21:07

Well I hope peeps find it useful. The only other thing I would recommend would be to reset VO to factory settings. Then, for every single change you make to VO utility, load up Safari, and see if you can't narrow down what specifically causes the "not responding" issue. 🙁

By Brian on Tuesday, September 26, 2023 - 21:07

You can export your settings. If you ever feel brave and want to try my alternative suggestion. And it does not work out for you, you can just import your old settings back. Easy peasy.
On a side note, the issue with the voice switching between "voice x" and "voice y" could be the bug mentioned in another post where Spoken Content settings are overlapping with VO settings (at least in Ventura).
Just my 2 cents. 😅

By Jimmy on Tuesday, September 26, 2023 - 21:07

Hi, I tried assigning a keyboard commander to the script that has been saved to a .scpt file in Finder.
In the first time running, it asked for the accessibility permission which I have granted. Subsequent attempts have been successful, however, the script didn't turn VO back on for me. I needed to manually turning it on with Command+F5.
Please could you confirm whether this is intentional? If not, please could you tell me how to make it work as intended?
I'm not that well-verse with programming and stuff, so please let me know if there was something I did incorrectly too.

By Brian on Tuesday, September 26, 2023 - 21:07

Hey there,

I am guessing that Safari is messing things up. Try the following instead:

# Begin code
tell application "System Events"
key code 96 using command down
end tell
delay 1
tell application "System Events"
key code 96 using command down
end tell
#End code

This will "only" disable and re-enable VoiceOver. Which means you have to open Safari yourself. You "might" have to grant permissions again. Sorry about that.. 😅