Type into not working, but sometimes types after clicking somewhere else

Basically the title. I’ve tried SendWindowMessages, SimulateType. Click before typing, and activate. Clicking cancel or clicking in general sometimes prompts the program to type but doesn’t seem consistent.