[R] Problem with batch-file

Dirk Eddelbuettel edd at debian.org
Mon Nov 3 16:06:05 CET 2003


On Mon, Nov 03, 2003 at 10:35:57AM +0100, Morach Sascha, moracsa1 wrote:
> Hi
>  
> I have written a graphical user interface using tcltk. Now I would like to run it under rterm.exe with a batch file. I tried the following code written in a .bat file:
>  
>  d:\R\rw1071\bin\Rterm.exe --no-restore --no-save <d:\RGui.r> d:\RGui.out
>  
> The problem is that rterm does open but the gui isn't running properly. After a few seconds rterm is closeing without doing anything more than print the first gui window. If I run the same r-code in the normal RGui.exe I don't have any problems.
> Does anyone know what I'm doing wrong, or is there a help file which explains  the needed code?

I use a trick which Peter D. once emailed. You need to initialise a
variable, say, wait.gui, to zero. If and when the user wants to quit
(File->Exit or whatever, you also need to fetch the window closing event
from the window manager) you set wait.gui to 1.  Then a call to

	tk.wait(wait.gui)
	
in your main part should be all that is needed.

Hth, Dirk

-- 
Those are my principles, and if you don't like them... well, I have others.
                                                -- Groucho Marx




More information about the R-help mailing list