I have tried to use Applescript to simulate a keyboard event
tell application "System Events"
keystroke "This is a test"
and use Quartz event service
CGEventRef e = CGEventCreateKeyboardEvent (NULL, (CGKeyCode)52, true);
CGEventPost(kCGSessionEventTap, e);
CFRelease(e);
However, none of these methods are actually creating low level HID input events (IOHIDSystem "HIDIdleTime" was not reset)