Direct Selection without Mouse

Hello, I’m using a macro addon which doesn’t record mouse clicks or the cursor location: Does anyone know a way to direct select an object from the outliner, without using the mouse at all (click or cursor)?

Or similarly, change a secondary selected object to become primary selected without using the mouse?

(Sorry if these are the wrong terms: ‘primary’ selected is outlined in orange and has all the operations available, while ‘secondary’ selected is in red and is very limited)

I have been searching for a solution, but have found nothing yet. I tried keybinds as well to direct select objects with the keyboard, but they still relied on the mouse cursor being on the actual object to work.

An operation/code that can switch a secondary selected object to become primary selected, without using the mouse – or even a way to direct select an object without using the mouse at all (cursor proximity included) would be amazing. The ‘select’ menu always highlights my armature / mesh parts as secondary as well.

Any help would be greatly appreciated, thank you!