title: Scripting GNU screen
body: <p>I've been trying to come to terms with scripting in GNU Screen. Upon reading the man pages and a few other examples, I understand that we can use the <code>at</code> command or the <code>-X</code> argument for sending commands to screen sessions. </p>
  
  <p>Let me explain my situation. I need to write a script that runs from with in an existing screen session. This script should create new windows, set their titles, browse to a specific directory and run a program in each of these windows. </p>
  
  <p>The problem with the <code>at</code> command is that I can only send one command at a time. When I create a new window using <code>at</code> command, it will not be possible for me to obtain the window number of that newly created window. Because of this, I will not be able to send any more commands to that new window. How can I retrieve the window number of this new window? </p>