大家好,
我想知道是否有一種方法可以告訴您是在處理數據表還是在分析窗口。我想要一條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 />);