! SMIC.scr ! "Set MST Intensity Correction" ! This is a MetroScript file to be run by Zygo MetroPro software. ! The purpose of this script is to automate the task of setting ! certain control values in apps targeted for the MST instrument. ! The controls are associated with an aspect of FTPSI data analysis ! known as intensity correction ! For best metrology, it is recommended that the intensity correction ! controls should always be set to On. ! They should only be set to Off for diagnostics purposes. ! This script automates the task of setting the controls to On. ! Using this script can save effort because in the case of some ! apps, the target controls have not been instantiated (they are not visible). ! This is the name of a text file to receive the output from this script. result_file_name$ = "SMIC.txt" dim msg$[999] dim cmd$[999] ! Array of control path strings dim ctrl_path$(10)[99] num_ctrl_paths% = 10 ! These are the paths for referencing all the controls associated with ! intensity correction in all the MST application types. ! Each MST app type provides a different set of controls. ! No single app type provides all these controls. ctrl_path$(1) = "Controls / Acquisition / Intens Correction" ctrl_path$(2) = "Test Calibration Pixel Trace / Controls / Correct Intens Variation" ctrl_path$(3) = "Point Trace / Controls / Correct Intens Variation" ctrl_path$(4) = "Intensity Point Trace / Controls / Correct Intens Variation" ctrl_path$(5) = "Interactive Point Trace / Controls / Correct Intens Variation" ctrl_path$(6) = "FC Intensity Point Trace / Controls / Correct Intens Variation" ctrl_path$(7) = "FC Test Calibration Pixel Trace / Controls / Correct Intens Variation" ctrl_path$(8) = "FC Reference Calibration Pixel Trace / Controls / Correct Intens Variation" ctrl_path$(9) = "EC Intensity Point Trace / Controls / Correct Intens Variation" ctrl_path$(10) = "EC Test Calibration Pixel Trace / Controls / Correct Intens Variation" ! Open results file on error goto CANT_CREATE_RESULTS_FILE assign @result_file to result_file_name$ "w" off error msg$ = "Results output by MetroScript SMIC.scr\n(Set MST Intensity Correction)" output @result_file; msg$ output @result_file; "" num_ctrls_found% = 0 num_ctrl_values_changed% = 0 for ctrl_path_index% = 1 to num_ctrl_paths% on error goto CTRL_PATH_NOT_FOUND ! Get the ID for the control ctrl_id% = getid(ctrl_path$(ctrl_path_index%)) off error msg$ = ctrl_path$(ctrl_path_index%) output @result_file; msg$ num_ctrls_found% = num_ctrls_found% + 1 ! Get the control value ctrl_value% = getnum(ctrl_id%, "") if ctrl_value% = 0 then ! Set the control to On (1) setnum(ctrl_id%, 1, "") msg$ = "Changed from Off to On" num_ctrl_values_changed% = num_ctrl_values_changed% + 1 else msg$ = "Already set to On" endif output @result_file; msg$ output @result_file; "" goto NEXT_CTRL_PATH CTRL_PATH_NOT_FOUND: off error goto NEXT_CTRL_PATH NEXT_CTRL_PATH: next ctrl_path_index% assign @result_file to "" if num_ctrls_found% = 0 then msg$ = " No controls associated with intensity correction exist in this app. " on error goto DIALOG_ESCAPED i% = dialog(msg$, 3) off error goto SCRIPT_EXIT else msg$ = " Found " & val$(num_ctrls_found%) & " controls associated with intensity correction in this app. " endif if num_ctrl_values_changed% = 0 then msg$ = msg$ & "\n All controls were already set to On. " else msg$ = msg$ & "\n " & val$(num_ctrl_values_changed%) & " control(s) changed from Off to On. " if num_ctrls_found% > num_ctrl_values_changed% then num_ctrl_values_unchanged% = num_ctrls_found% - num_ctrl_values_changed% msg$ = msg$ & "\n " & val$(num_ctrl_values_unchanged%) & " control(s) already set to On. " endif endif msg$ = msg$ & "\n Detailed results were output to file " & result_file_name$ & " " msg$ = msg$ & "\n Do you want to view the results file? " msg$ = msg$ & "\n (Click YES to view the results file using NotePad.) " on error goto DIALOG_ESCAPED i% = dialog(msg$, 4) off error if i% <> 0 then cmd$ = "cmd /c notepad " & result_file_name$ & " &" i% = execute(cmd$) endif goto SCRIPT_EXIT SCRIPT_EXIT: end CANT_CREATE_RESULTS_FILE: off error msg$ = " Cannot create results file " & result_file_name$ & " " on error goto DIALOG_ESCAPED i% = dialog(msg$, 2) off error goto SCRIPT_EXIT DIALOG_ESCAPED: off error goto SCRIPT_EXIT