[R] TR: Simulate keyboard

Thibault Charles thibault.charles at solamen.fr
Mon May 16 13:50:15 CEST 2011


Thank you for your response.

In this case, do you think it is possible to write a little program in java
which would execute my script and simulate a press on my keyboard ?

If yes, does anybody experiment it and could give me some help or advice ?

Thanks,

Thibault Charles
Solamen
Audencia - 8 route de la Jonelière
44300 Nantes
+33 2 40 37 46 76

-----Message d'origine-----
De : r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] De
la part de Philipp Pagel
Envoyé : lundi 16 mai 2011 12:29
À : r-help at r-project.org
Objet : Re: [R] TR: Simulate keyboard

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=TR
UE)
> }
> 
> 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/

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list