2
votes

Tibco SpotFire 6.5

I have multiple Iron Python scripts written for each button (around 18) I have in analysis.dxp. I want each script as text or any format where I can save my current state of Iron Python scripts (called as backup of my versions).

Is there any way to do it?

2
By "current state" do you mean what the last variable values were, or just the current version of the script? Are you just looking for an automated way to copy all scripts from a given dxp? - scsimon
automated way to copy all scripts from a given dxp - DhavalK
I don't have a way. Maybe Niko can help if he has a break - scsimon

2 Answers

2
votes

You can use ScriptManager Object of Spotfire. The small script from this page can be used to extract all scripts from Analysis in plain text.

0
votes

The IronPython script below will print out information about the scripts stored in the ScriptManager object, as well as the script itself.

Per Oliver Drummond's comment/question about also printing out the language, you can use ScriptDefinition.Language.Language. See https://docs.tibco.com/pub/doc_remote/spotfire/7.11.1/doc/api/html/T_Spotfire_Dxp_Application_Scripting_ScriptDefinition.htm

from System.Collections.Generic import Dictionary
from Spotfire.Dxp.Application.Scripting import ScriptDefinition
from Spotfire.Dxp import Application

script_list = list()

for i in Document.ScriptManager.GetScripts():
    print i.Name
    print i.Description
    print i.Language.Language
    print i.ScriptCode
    print "_____________"