如何使用「取得腳本」取得大綱框標題你好,
我嘗試使用“獲取腳本”函數來獲取報告信息,以便將其合併到一個 .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;