[texhax] controlling pdf reader (was Re: beamer and "Read out loud")

James Quirk jjq at galcit.caltech.edu
Mon Apr 19 04:11:30 CEST 2010


Tom,

On Sun, 18 Apr 2010, Tom Schneider wrote:

> James:
> 
> > Linux AR9.x now provides a reload functionality, key short-cut Ctrl-R,
> > which basically does what you want. But I don't think it has made it
> > into either the Windows or OSX versions. 
> 
> Not quite - as I mentioned in the previous posting, I want it hands
> (mouse) free.  Oh, the atchange program is at;
> 
> http://alum.mit.edu/www/toms/atchange.html
> 
> > > Maybe you have an idea?
OK. You didn't reply yet as to what platform you're using.
But with Linux, all you need do is:

(i) Install xdotool which you can grab from:

   http://www.semicomplete.com/projects/xdotool

The description from its manual page reads:

xdotool lets you programatically (or manually) simulate keyboard input and 
mouse activity, move and resize windows, etc. It does this
       using X11's XTEST extension and other Xlib functions.


(ii) Add the following perl to your atchange script:

my $wid= (`xdotool search --title "Adobe Reader"`)[0]; chomp $wid;
system("xdotool key --window $wid ctrl+r");

The first line will get the window used by AR. Note xdotool may return 
more than one window so we grab the first one and get rid of the line 
separator. The second line then sends the reload short-cut to the target 
window.

I've tested it at my end (OpenSUSE 10.3+KDE+AR9.3.2) and
it works quite nicely, but I've yet to fully explore
xdotool so I can't comment on any foibles it might have.

James



More information about the texhax mailing list