I can't help with 100% of the solution to this problem but can write that there is a keyboard macro package for Linux and it's called expect.
I can't help with 100% of the solution to this problem but can write that there is a keyboard macro package for Linux and it's called expect.