简体   繁体   中英

Launch R shiny interface

I created my run.vbs script following this tutorial .

When I launch run.vbs manually, GoogleChromePortable opens and I can access to my application, but when I call it from my C# application ( System.Diagnostics.Process.Start(mypath + "run.vbs")); nothing happens. The "random" file is not created and I don't have error. I replaced the relative path in run.vbs by absolute path to avoid the error "The system could not find the file specified", but I'm still stucked in my WinForms app.

I tried to create .bat and .cmd, they all work fine manually but not by code execution. I tried the |process.WaitForExit()| :

var process = Process.Start(mypath + "run.bat");
process.WaitForExit();

no GoogleChromePortable window...

Ok, here is my solution...

In the tutorial, the runShinyApp.R refers to a relative path ( ./Shiny ) which is not initialized when I call the run.vbs from my application.

So, I replaced run.vbs by run.bat, and I call runShinyApp.R with this bat, containing :

CD /d "%~dp0"
%~dp0R-Portable\App\R-Portable\bin\Rscript.exe --vanilla %~dp0runShinyApp.R

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM