简体   繁体   English

闪亮的应用程序无法在Shinyapps.io上运行

[英]Shiny application not working on Shinyapps.io

I have a piece of R code in my shiny application that basically triggers a shell script that runs a macro in a excel: 我的闪亮应用程序中有一段R代码,该代码基本上会触发在Excel中运行宏的shell脚本:

path_to_vbs_file = "www/Macro_Trigger.vbs"
shell(shQuote(normalizePath(path_to_vbs_file)), "cscript", flag = "//nologo")

The .vbs code is: .vbs代码是:

Option Explicit

ExcelMacroExample

Sub ExcelMacroExample() 

  Dim xlApp 
  Dim xlBook 
  Dim fso
  Dim curDir

  Set xlApp = CreateObject("Excel.Application") 
  Set fso = CreateObject("Scripting.FileSystemObject")
  curDir = fso.GetParentFolderName(wscript.ScriptFullName) 
  Set xlBook = xlApp.Workbooks.Open(curDir & "\KPI_Report.xlsm", 0, False) 
  xlApp.Application.Visible = False
  xlApp.DisplayAlerts = False
  xlApp.Run "ConvertTextToNumber"
  xlApp.ActiveWorkbook.SaveAs curDir & "\KPI_Report.xlsm"

  xlApp.ActiveWorkbook.Close
  xlApp.Quit

  Set xlBook = Nothing 
  Set xlApp = Nothing 

End Sub 

The code works fine on local Windows OS but fails on shinyapps.io server. 该代码在本地Windows操作系统上工作正常,但在Shinyapps.io服务器上失败。 I tried using system command instead of shell: 我尝试使用系统命令而不是shell:

path_to_vbs_file = "www/Macro_Trigger.vbs"
system(shQuote(normalizePath(path_to_vbs_file)), intern = FALSE)

But that doesn't help :( 但这无济于事:(

shinyapps.io runs Linux, so executing a VBS script is not going work, unfortunately. Shinyapps.io运行Linux,因此不幸的是,执行VBS脚本无法正常工作。 My suggestion would be to port your Excel macros to pure R code. 我的建议是将您的Excel宏移植到纯R代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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