[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sending key strokes with screen
From: |
Michael Grant |
Subject: |
Re: sending key strokes with screen |
Date: |
Tue, 10 Jul 2007 18:59:24 +0100 |
Someone on this list, I cannot remember who, recommended using a
register and then processing the register. Here is a command I wrote
which redisplays a screen and it's save buffer so when you log back in
and reattach, you can get then scroll up:
register A "\001:hardcopy -h /tmp/mgrant.screendump\015\001:exec
/home/mgrant/bin/redraw-screen\015"
# bind ^A l (ell) to redraw the screen
bind l process A
and the redraw-screen script:
#!/usr/local/bin/perl
undef $/;
# expects screen dump to already be in /tmp/mgrant.screendump
# from the :screendump -h command in screen
open(FP,"</tmp/mgrant.screendump");
# read screen dump into $a
$a=substr(<FP>,0,-1);
# special case, if the prompt is the last thing in the dump
# append a space
if ($a =~ /\d+]$/s) {
$a.=" ";
}
# redraw the screen
print $a;
# delete the screen dump file
unlink "/tmp/mgrant.screendump";
On 7/10/07, Dan Burt <address@hidden> wrote:
i am using screen to start another process on my linux server, so i can
attach/detach whenever i need to.
however, i would also like to programmatically send commands to this active
screen session, but it must be prefixed with a "Ctrl + a" key combination,
followed by any other key depending on what needs to be done.
how can this be done? i have tried many variations but nothing seems to get
the desired result!
many thanks in advance...
Regards,
Dan Burt
________________________________
Inbox full of unwanted email? Get leading protection and 1GB storage with
All New Yahoo! Mail.
_______________________________________________
screen-users mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/screen-users