Claris Resolve: Preventing Scripts from Opening

This information was provided by Claris Corporation on 16 March 1998, and incorporated into Apple Computer's Tech Info Library.
Developers sometimes want to prevent users of their scripts from opening / seeing them. It is not possible to prevent a script from opening, however, the following script will prevent a user from opening a button script when placed in the worksheet script.

This means that even the creator of the script cannot open it. The only way to open a script with this function installed is to immediately press Command-period after requesting the script to open. This, of course,will not work if BREAK OFF has been executed prior to this function. It is suggested, therefore, not to use BREAK OFF in conjunction with this script!

*************************************************************
on deactivate
call worksheet1:checkwindow()
end deactivate

function checkWindow()
if windowtype() = 7
close now
end if
end function
Published Date: Feb 18, 2012