var TextEdit = Application ( "TextEdit" ) ; TextEdit . activate ( ) ; delay ( 1 ) ; sys = Application ( "System Events" ) ; sys . keystroke ( "JavaScript" ) ; sys . keyCode ( 36 ) ; sys . keystroke ( "Sample Program" ) ;