try do shell script "spctl --status" do shell script "spctl --master-disable" with administrator privileges display dialog "Assessment disabled!" buttons {"OK"} default button 1 on error try do shell script "spctl --status" display dialog "Error!" buttons {"OK"} default button 1 on error do shell script "spctl --master-enable" with administrator privileges display dialog "Assessment enabled!" buttons {"OK"} default button 1 end try end try