else answer "Failed: unexpected file system error: " & the result with "OK"
end mouseUp
-- part contents for background part 1
----- text -----
This XCMD removes the password from a Hypercard Stack (filetype "Stak"), and sets it
to empty. Use it in conjuntion with XFCN "FileName" so that only a filetype of "Stak" can only be chosen. An error trapping numerical result is returned after attempt. BE CAREFUL!
result = empty --successful deprotection
result = -44 -- unsuccessful, disk was locked
result = -49 -- unsuccessful, file was busy
The button above will prompt for a stack, then (if possible) remove any password for that stack and set the maximum access level back to Scripting.
This button is provided in the interests of those who somehow forget the password assigned to a stack. Please use it responsibly.
-----------------------
example:
on mouseUp
put filename("STAK") into fname
if fname is empty then exit mouseUp
deprotect fname
if the result is empty
then answer "Deprotect Successful" with "OK"
else if the result is -49
then answer "Sorry, that file is busy."
else if the result is -44
then answer "Sorry, the disk is locked."
else answer "Failed: unexpected file system error: " & the result with "OK"