Is it possible to make a program that writes at our place?

Imagine that if I execute my program, it launches google chrome and it opens like gmail, it enters my mail, my password and stop. Or if I enter in the linux terminal "open gmail" it does the same.

Is it possible to do this ? In C ? In bash ? How is it called ?