How do built in macros on Emulators work?

I’m building a script to automate some stuff on my Android emulator I’m currently using pyautogui to do it tho it would be nice if there was some sort of way I can directly interact with the emulator without it relying on my mouse
I know there’s an option using ADB but that requires the android to be rooted
a lot of android emulators like Nox, Bluestacks, LDplayer have built-in macros that don’t require the device to be rooted.

How do these emulators send commands to the emulator is that something I can tap into and send commands through that instead?


Answer: These emulator run on virtual machines their macro is sending input command from the virtual machine input API