! ! UserZip.scr ! 02/18/2003 PAL Added RESUME_NEXT error handler that ignores errors and ! USER_ZIP_ERR_EXIT error handler that displays the error. Also ! made sure there is always an appropriate error handler in use. ! 07/17/2002 PAL Added code so there is always an error handler ! 10/1/99 pal Restructured scripts and standardized variable naming. ! 12/01/97 mdc Added lines specifically for AutoCam ! 10/08/97 mdc Created this script to be the controlling script over Zipping ! ! This script can be modified by the user to add pre and post ! zipping activities. Note that the loading of the Zipped data ! is done here and not done in ZipStitch.scr. ! dim ZipFn$[200] dim ZipMaskFn$[200] dim ZipMsg$[200] START_OF_ZIP: ! ! runscript(0, "Any script you want to before zipping") ! ! Preset the return value to "No" in case the user presses ESC ok = 0 ZipMsg$ = " Position at Upper Right of Lower Area \n" ZipMsg$ = ZipMsg$ & " Yes to Begin, No to Exit " on error gosub RESUME_NEXT ok = dialog(ZipMsg$,4) on error goto USER_ZIP_ERR_EXIT if (ok = 0) then goto USER_ZIP_EXIT ! Examples of setting controls ! RemoveT_RId = getid("SurfaceWavefrontMap(T+R)/controls/remove") ! FilterT_RId = getid("SurfaceWavefrontMap(T+R)/controls/filter") ! setnum(RemoveT_RId,1,"") ! turn off surface removal in the Test + Reference Window ! setnum(FilterT_RId,1,"") ! turn off filtering in the Test + Reference Window gosub CLEAR_USER_ABORT runscript(0, "ZipStitch.scr") ! run the Standard Zip script ! ! At this point the Zipping is complete. ! The next statement loads the zipped data. ! If any controls need to be changed, change them here so the analysis ! will be done when the data is loaded ! ! runscript(0, "Any script you want to before the data is loaded") ZipFileID = getid( "Controls/ZipStitch/ZipFile" ) ZipFn$ = getval$( ZipFileID ) ZipMaskCntl = getid("controls/ZipStitch/AutoLoadMasks") AutoLoadZipMask = getval(ZipMaskCntl, "") if ( AutoLoadZipMask = 1) then ZipMaskFileCntl = getid("controls/ZipStitch/MasksFile") ZipMaskFn$ = getval$(ZipMaskFileCntl) on error gosub NO_ZIP_MASK loadmasks(ZipMaskFn$) on error goto USER_ZIP_ERR_EXIT endif on error goto NO_ZIP_FILE loaddata( ZipFn$ ) on error goto USER_ZIP_ERR_EXIT ZipStProcStsCntl = getid("controls/ZipStitch/StoreProcessStats") ZipStProcSts = getval( ZipStProcStsCntl, "" ) if ( ZipStProcSts = 1 ) then storeprocstats ! runscript(0, "Any script you want to after zipping") goto USER_ZIP_EXIT NO_ZIP_FILE: gosub CHK_USER_ABORT if ( g_bUserAbort = 0 ) then on error gosub RESUME_NEXT ok = dialog(" Could not find zip file: " & ZipFn$, 2) endif goto USER_ZIP_EXIT USER_ZIP_ERR_EXIT: on error gosub RESUME_NEXT ok = dialog(" Error Occurred \n " & errm$, 2) goto USER_ZIP_EXIT USER_ZIP_EXIT: end ! ! SUBROUTINES ! ! ! NO_ZIP_MASK - displays error message when the mask could not be found ! NO_ZIP_MASK: on error gosub RESUME_NEXT ok = dialog(" Could not find mask file: " & ZipMaskFn$, 2) error return ! ! RESUME_NEXT - Ignores the error ! RESUME_NEXT: error return ! ! CHK_USER_ABORT - Checks to see if the user pressed the ESC key ! CHK_USER_ABORT: g_bUserAbort = 0 if (trim$(errm$) = "Processing aborted.") then g_bUserAbort = 1 ! Delete the old file if (g_bUNIX = 1) then l_nTemp = execute("rm -f UserAbort" ) else l_nTemp = execute("erase /f /q UserAbort" ) endif ! Create the new file assign @fpUserAbort to "UserAbort" "w" assign @fpUserAbort to "" else on error gosub RESUME_NEXT ! Get a new error message l_nTemp = 1 / 0 ! Try to open the file assign @fpUserAbort to "UserAbort" "r" if ( trim$(errm$) = "Cannot open 'UserAbort' for mode 'r': No such file or directory" ) then g_bUserAbort = 0 else g_bUserAbort = 1 endif assign @fpUserAbort to "" on error goto USER_ZIP_ERR_EXIT endif return ! ! CLEAR_USER_ABORT - Erase the fact that the user pressed the ESC key ! CLEAR_USER_ABORT: on error gosub RESUME_NEXT if (g_bUNIX = 1) then l_nTemp = execute("rm -f UserAbort" ) else l_nTemp = execute("erase /f /q UserAbort" ) endif l_nTemp = 1 / 0 on error goto USER_ZIP_ERR_EXIT return