大家好,
我想知道是否有一种方法可以告诉您是在处理数据表还是在分析窗口。我想要一条if语句,以便如果您在数据表中,脚本将做一件事;如果您在分析窗口中,脚本将做其他事情。
感谢您的任何想法!
史蒂夫
您应该能够检查哪个窗口处于活动状态获取窗口标题并与Try-structure一起使用数据表(引用)<<获取名称(要么N行(数据表(参考)例如。
例:
Names Default To Here(1);<BR />Open("$SAMPLE_DATA/Consumer Preferences.jmp");<BR />wait(2);<BR />curWindow = current window() << Get Window Title; //get window title to curWindow variable<BR />//use Try to check if curWindow is datatable with << Get name or N Rows<BR />Try(<BR />//Show(N Rows(Datatable(curWindow))),<BR />Write(Datatable(curWindow) << Get Name || " --- this is datatable\!N"), //datatable<BR />Write(curWindow || " --- this is not datatable\!N"); //not datatable<BR />);<BR />wait(1);<BR />//create "analysis" which should became active<BR />nw = New Window("Consumer Preferences",<BR />Graph Builder(<BR />Size(495, 450),<BR />Show Control Panel(0),<BR />Variables(X(:Single Status)),<BR />Elements(Points(X, Legend(2)))<BR />);<BR />);<BR />wait(1);<BR />//repeat test used earlier<BR />curWindow = current window() << Get Window Title;<BR />Try(<BR />Write(Datatable(curWindow) << Get Name || " --- this is datatable"), //datatable<BR />Write(curWindow || " --- this is not datatable"); //not datatable<BR />);