Spotfire自动导出 [英] Spotfire Export Automatically

查看:59
本文介绍了Spotfire自动导出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我完全不确定我所拥有的工具是否可以满足我的需求,但我想我会问.

I'm not at all sure that what I need is possible with the tools that I have, but I thought I'd ask.

我有以下Python脚本(从技术上讲是IronPython,但我不完全了解其中的区别),我是从博客中提取并针对我的目的进行了修改的:

I have the following Python script (technically IronPython, but I don't fully understand the difference), that I pulled from a blog and modified for my purposes:

import datetime
from System.IO import StreamWriter
from Spotfire.Dxp.Application.Visuals import TablePlot

tempFolder = "C:\\Spotfire Exports\\"
tempFilename = "Data.txt"

writer = StreamWriter(tempFolder + tempFilename)
vTable.As[TablePlot]().ExportText(writer)

print tempFolder + tempFilename

脚本本身可以很好地工作,但是问题是我需要能够在一天的某个特定时间自动运行此脚本,即,我需要在早晨更新* .txt文件,然后才能获取该文件.到我的桌子. (该项目从无法通过MS Access访问的数据库中提取.)

The script itself works perfectly fine, but the problem is that I need to be able to make this run automatically at a certain time of day, i.e., I need the *.txt file to be updated in the morning before I get to my desk. (The project pulls from a database that isn't accessible through MS Access.)

尽管脚本运行良好,但我必须手动按下按钮才能将其激活.我似乎找不到任何方法来使脚本在文件上运行(以便我可以使用Windows Task Scheduler)在文件打开时运行.

Although the script runs fine, I have to manually push the button to activate it. I can't seem to find any way to have the script run on file open (so that I can use Windows Task Scheduler) to make it run when the file is opened.

有人知道有没有办法做到这一点?

Does anybody know if there's a way to do this?

记住,我没有可用的Visual Studio.我已经尝试过Visual Studio Express,但它似乎无法访问Spotfire SDK宏.

Bear in mind, I do not have Visual Studio available to me. I already tried Visual Studio Express, and it doesn't seem to be able to access the Spotfire SDK macros.

推荐答案

您可以利用JavaScript单击加载时的按钮并将该按钮用作python脚本.像这样:

You can utilize JavaScript to click a button on load and have that button be your python script. Like so:

window.onload = function callButtonClickEvent(){
          document.getElementById('YOUR_SPOTFIRE_CONTROL_ID').click();
}

通过在您使用的文本框中单击编辑HTML",您可以看到Spotfire已为您分配了按钮的ID.上面的代码将在加载后单击该按钮.

By clicking "edit HTML" in the text box you're using you can see the ID spotfire has assigned your button. The above code will click that button once upon loading.

如果您不希望将按钮显示给最终用户(如果适用),则可以将其放在隐藏的div或span中:

If you do not want your button to be shown to end users (if applicable) then you can put it inside a hidden div or span:

<span style='display:none'><SpotfireControl id="YOUR_SPOTFIRE_CONTROL_ID" /></span>

然后,一旦完成设置,它就可以根据您的Windows任务计划程序的要求运行您的脚本.

Then once this is setup it should run your script when opened as per your windows task scheduler as you desired.

如果您对实施有任何疑问,请告诉我.

Let me know if you have any questions regarding implementation.

这篇关于Spotfire自动导出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆