Can you use keystrokes in a Script?

for example: you press d,s,a,e really fast then something happens like a GUI appears.

if you can could you give me an example?

Have you read the documentation?