首页 > 解决方案 > 如何使用 Spotfire Webplayer 中的 ironPython 脚本打开 Windows 资源管理器

问题描述

我使用下面的 IronPython 脚本打开 Windows 资源管理器以定义在客户端 Spotfire 中完美运行的路径。

当我在 Spotfire Webplayer中运行相同的脚本时,Windows 资源管理器不会打开。

没有显示错误消息,但我在底部工具栏中看到以下信息:Javascript:void(0);

# This script executes an external program. 

#Script Parameters
program = 'explorer.exe'
url = 'file://U:/Data/Downloads/'

#A. We need the Process class to execute external programs
from System.Diagnostics import Process

#B. Create new process instance
p = Process()

#B.1 Configure your process
p.StartInfo.UseShellExecute = False
p.StartInfo.RedirectStandardOutput = True
p.StartInfo.FileName = program
p.StartInfo.Arguments = url

#C. Start the process and wait 
p.Start()
p.WaitForExit()

如何更新我的脚本以使其也可以在 Spotfire Webplayer 中运行。

标签: ironpythonexplorerspotfire-webplayer

解决方案


在 Spotfire webplayer 上,脚本在服务器上运行。当你创建一个进程来执行一个程序时,它是在服务器上创建的。这就是为什么您无法在客户端上打开程序(如资源管理器)的原因。

您不能在客户端上执行此操作,最好的方法可能是有一个 TextArea,您可以在其中放置文件夹的链接。这样,当用户单击链接时,它会打开资源管理器。


推荐阅读