From: Robin L. P. <rlp...@di...> - 2008-12-12 14:20:59
|
On Fri, Dec 12, 2008 at 08:46:45AM -0500, Bryan Bueter wrote: > As for running mutt through expect, it seems to ignore everything > i send, even if I just try and open it up quit. So I dont think > there is actually anything wrong with what your sending, just how > its being interpreted by mutt. Mutt works just fine seding "j" keys; you have to expect something to see the updates though. How about this; I've got an example that uses "less", which pretty much everybody should have. Run: seq 1 500 >/tmp/crap Then try this code: - ---------------------- #!/usr/bin/perl use warnings; use strict; use Expect; my $timeout = 5; $Expect::Log_Stdout = 1; #$Expect::Debug = 1; #$Expect::Exp_Internal = 1; my $exp; $exp = new Expect (); $exp->raw_pty(1); $exp = Expect->spawn("/usr/bin/less", "/tmp/crap") or die "Cannot spawn client: $!\n"; $exp->log_file( "/tmp/exp.out", "w" ); $exp->expect($timeout, "crap" ); print "done expect.\n"; $exp->send("\c[[B"); $exp->send("\c[[B"); $exp->send("\e[B"); $exp->expect($timeout, "26" ); sleep 5; print "done arrows.\n"; $exp->send("j"); $exp->send("j"); $exp->send("j"); sleep 5; $exp->expect($timeout, "26" ); $exp->send("q"); sleep 5; $exp->expect($timeout, "crap" ); print "Done sending.\n"; - ---------------------- As you can see, the arrow keys do nothing, but the j keys work just fine. -Robin -- They say: "The first AIs will be built by the military as weapons." And I'm thinking: "Does it even occur to you to try for something other than the default outcome?" -- http://shorl.com/tydruhedufogre http://www.digitalkingdom.org/~rlpowell/ *** http://www.lojban.org/ |