如何使用“获取脚本”获取大纲框标题你好,
我尝试使用“获取脚本”函数来获取报告信息,以便将其合并到一个 .jrp 文件中(类似于这篇文章中的细节,只是我还要添加一些额外的组件,这些组件会在启动时运行,因此我没有使用“保存报告窗口”函数)。我遇到的问题是,我还需要获取 OutlineBox 的标题(这些标题由脚本命名,并且会在我的整个项目中跟踪更改),否则我无法重新生成报告。请参见下面的示例。
我是否在“获取脚本”函数中遗漏了什么,导致无法同时获取大纲框标题?
names default to here(1);
report_win = New Window("Testwindow",
Outline Box("tester",
Textbox("Test")
)
);
report_win << Get Script;
//RESULT: V List Box( V List Box( Outline Box( Text Box( "Test" ) ) ) )
//If I were to take that same script and try to recreate as a jrp file works....
//New Window("test", V List Box( V List Box( Outline Box( Text Box( "Test" ) ) ) ))
//resulting failure: expected character arg 1 in access or evaluation of 'Outline Box' , Outline Box/*###*/(Text Box( "Test" ))
自动化和脚本编写回复:如何使用“获取脚本”获取大纲框标题我不确定你是否可以使用“获取脚本”来实现你想要的功能。具体应该怎么做取决于你的最终目标。我不太确定为什么你不能使用“保存窗口报告”,但我可能遗漏了一些信息,不过这或许也是一个可行的方案。
Names Default To Here(1);
report_win = New Window("Testwindow", << Type("Report"), Outline Box("tester", Text Box("Test")));
report_win << Save Window Report("$TEMP/test.jrp");
s1 = report_win << get script;
wait(0);
s2 = Parse(Load Text File("$TEMP/test.jrp"));
wait(0);
Delete File("$TEMP/test.jrp");
Show(s1, s2);
ob_script = Extract Expr(s2, Outline Box(WildList()));
s1 = V List Box(V List Box(OutlineBox(Text Box("Test"))));
s2 = New Window("Testwindow", Outline Box("tester", Text Box("Test")));
Outline Box("tester", Text Box("Test"))
回复:如何使用“获取脚本”获取大纲框标题我认为使用 XPath 可能更简单直接。请看下图:
Names Default to Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
biv = dt << Bivariate( Y( :weight ), X( :height ), Fit Line( 1 ) );
rpt = biv << Report;
outlineNames = (rpt << XPath( "//OutlineBox" )) << Get Title;