I have an iMac running OS 10.4.2. It used to have a wired mouse, but it doesn't work any more. I have a Magic Mouse (the kind that takes AA batteries) that was paired with another Mac before. I'd like to pair it with this one.
I can use CMD+space to open system preferences and see that the mouse is discovered. However I can't figure out how to access the pair button with the keyboard.
I've tried CTRL+F7 to change the way tabs move focus. That still doesn't let me focus the pair button.
Enter "mouse" and select the "Mouse" system preferences panel (probably the first item that comes up).
CTRL+F7 (or CTRL+Fn+F7) to change the way the tabs move focus.
TAB until "Set up Bluetooth device" is in focus.
SPACE to press the button.
Turn the mouse off and back on to put it pairing mode.
The mouse should come up in the list of devices. TAB to focus it, then space to pair.
Normally, by the time you get to step 2, OS X will automatically attempt to locate your mouse. In this case, the computer was already paired with some other mouse (which I can't find) so it didn't do that.
Patrick solution won't work on Monterey. But if you enable full keyboard access then you will be able to use SPACE to connect to the selected device in the Bluetooth window. To turn on the Full Keyboard Access you need to press Option + Command + F5.
Then you can follow the steps provided by Patrick to open the Bluetooth window and select the device + SPACE to connect.
Another option which should work, if you want to access this straight from the Bluetooth menu, is to run this AppleScript. It'll iterate through each device in the Bluetooth window, until it comes across one named "Patrick's mouse (home)", which is the one you want to pair, in this case. It'll then click the "Pair" button:
tell application "System Events" to tell application process "System Preferences" to tell table 1 of scroll area 1 of window 1
repeat with currentRow in rows
tell UI element 1 of currentRow
if exists (static text "Patrick's mouse (home)") then
click button "Pair"