[R] TR: Simulate keyboard

Philipp Pagel p.pagel at wzw.tum.de
Mon May 16 12:28:39 CEST 2011


On Mon, May 16, 2011 at 11:27:05AM +0200, Thibault Charles wrote:
> I cannot find a way to simulate a keyboard event as pressing the ?enter?
> key.
> for (i in 1:nombre_fichiers_monteCarlo){
> system(paste('"C:/Trnsys17/Exe/TRNExe.exe"',liste_dck_monteCarlo[i]),wait=TRUE)
> }
> 
> My problem is that at each step, trnsys ask the user to press ?enter? from
> the keyboard and I would like not have to press myself on ?enter?.
> 
> Does exist a function to simulate this kind of keyboard event ?

I don't think R can handle that (but I may be wrong). On a UNIX
platform, this kind of problem could be tackled with the expect
command. 

Your code above suggests you are on a Windows platform. I did a quick
google search and it seems that expect is available for windows as
part of the CYGWIN suite. And there also seems to be an expect for
windows from activestate:

http://docs.activestate.com/activetcl/8.5/expect4win/

cu
	Philipp

-- 
Dr. Philipp Pagel
Lehrstuhl für Genomorientierte Bioinformatik
Technische Universität München
Wissenschaftszentrum Weihenstephan
Maximus-von-Imhof-Forum 3
85354 Freising, Germany
http://webclu.bio.wzw.tum.de/~pagel/



More information about the R-help mailing list