简体   繁体   English

如何使用 Spotfire Webplayer 中的 ironPython 脚本打开 Windows 资源管理器

[英]How to open Windows explorer with ironPython script from Spotfire Webplayer

I use the below IronPython script to open a Windows Explorer to a define path which works perfectly within the client Spotfire.我使用下面的 IronPython 脚本将 Windows 资源管理器打开到定义路径,该路径在客户端 Spotfire 中完美运行。

When I run the same script within the Spotfire Webplayer , the Windows explorer don't open.当我在 Spotfire Webplayer 中运行相同的脚本时,Windows 资源管理器不会打开。

No error message is displayed, but I see the below info in the bottom toolbar : Javascript:void(0);没有显示错误消息,但我在底部工具栏中看到以下信息: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()

How can I update my script to make it work also into the Spotfire Webplayer.如何更新我的脚本以使其也能在 Spotfire Webplayer 中运行。

On Spotfire webplayer, the script is run on the server.在 Spotfire 网络播放器上,脚本在服务器上运行。 When you create a process to execute a program, it is created on the server.当您创建一个进程来执行程序时,它是在服务器上创建的。 That's why you can't open programs (like explorer) on the client.这就是您无法在客户端上打开程序(如资源管理器)的原因。

You can't do this on the client, the best way to do this is probably to have a TextArea in which you put the link of the folder.您不能在客户端上执行此操作,执行此操作的最佳方法可能是拥有一个放置文件夹链接的 TextArea。 That way, when a user click on the link it opens the explorer.这样,当用户单击链接时,它会打开资源管理器。

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

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