How to make Rscript stay open until gWidgets gui is closed - r

I have a script which launches various gWidgets windows with buttons that have functions attached. I'd like to be able to launch this with rscript.exe so others can use it without seeing R. My problem is that when I launch the script using rscript.exe myscript.r an rscript instance shows up in task manager, it loads all the packages, the widget pops up for a second, and then it's gone (including the rscript process from task manager) before the user can even do anything. How can I make the instance of rscript stay active until all the gWidgets windows are closed? If I launch the script from either Rstudio or Rgui it stays open until done. As a similar question, is there also a way to prevent the dialog box showing the various commands from coming up too? I'm using Windows 7 by the way.

Related

How to start Jupyter notebook in background?

I have installed Jupiter notebook using Anaconda. I run it as using jupyter notebook --no-browser in command prompt in windows 10. I want to run it as the background so that I don't accidentally close the command prompt. The problem here is, many users of systems accidentally close the command prompt, which affects other users.
Open Anaconda navigator.
Launch the jupyter notebook from it. It will run as a background process. Even if you close the Anaconda navigator, it works. So when you close the anaconda navigator, it asks do you want to kill the background process, make sure you unselect the checkbox. Check below screenshot.
This method worked well.
You can use START /b, but that will terminate the program when command window is closed. You will need a VBScript to accomplish this. This post show a simple script to accomplish this: https://superuser.com/questions/62525/run-a-batch-file-in-a-completely-hidden-way

R shiny and rscript.exe

I have tried to make use of a .bat in windows to open and run an r shiny app.
It all works and I even get the listening prompt displayed.
However, no web interface opens.
Has anyone else met this problem and resolved it?

How to kill shiny app in ESS without killing R process

Whenever I run a shiny app from ESS, it works, but I can't get the prompt back without killing the whole R session (like clicking the "Stop" button in RStudio). The normal Ctrl-C Cntrl-C, or Cntl-g don't work. So, I have to resort to Cntrl-x k. How do I kill the shiny process without killing R?
Well, I finally found out the reason. I had the option
(setq comint-prompt-read-only t)
set somewhere in my init files. Apparently, when this option is set it becomes impossible (well, beyond me anyway) to send a kill signal to the R process. I don't understand what is happening though. If I run a server directly from httpuv I can kill it even with the option set, but not when running an app through shiny.
you could use
C-c C-c
in iESS to quit the shiny app.

Creating executable file with R: How to keep GUI open running Rscript

I made a GUI using R, and I wanted to make an executable file for it, so other people can double click and launch the GUI without seeing any R code. I made a .bat file and have Rscript run my R code, but what happened is that the GUI is created and then closed, so I cannot interact with the GUI at all. So I want
to ask for any suggestion on how to make the GUI stay open until I close it? Or any other ways to make an executable file? Thanks!
BTW, I am using windows 7.

Consoles and Tabs

When I start the tomcat server from console using the startup.bat script, a new command window opens which is filled with java logging statements.
I use Console2 which leverages tabs for each open console window. Is it possible to let the java system create a new tab within console2 instead of just opening a new command window?
This has nothing to do with java, its merely down to the way the catalina.bat is called from startup.bat
catalina.bat can be called with either a "start" argument or a "run" argument.
run Start Catalina in the current window
start Start Catalina in a separate window
So open startup.bat, scroll to the bottom you should see
"%EXECUTABLE%" start %CMD_LINE_ARGS%
change that to
"%EXECUTABLE%" run %CMD_LINE_ARGS%
exit
I add an exit after to close the calling window.
Unless Console2 hooks any APIs that create console windows – no. And that's also highly unlikely that they do or even can. Console2 does nothing more than hook up input and output of console windows. What the programs in those do is beyond what it's interested in.

Resources