For this sort of thing, I would have it run a script on the host which uses
vmrun typeKeystrokesInGuest /path/to/whatever.vmx 'keystrokes'
but... I can't seem to get that to work right now, either with Fusion on my macOS host or in Workstation Pro on my Linux host... It says that I do not have sufficient permissions on the host, which seems a bit unusual. I do hope I'm just having a brain fade and doing something wrong and we haven't broken vmrun...
Workstation Pro also includes a REST API service which might support this sort of programmatic control too... I have not delved into it.
--
Darius