Made it fancy.
This commit is contained in:
parent
4329462e85
commit
23afb1f165
|
@ -1,13 +1,40 @@
|
|||
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
|
||||
script toggle
|
||||
try
|
||||
do shell script "spctl --status"
|
||||
display dialog "Error!" buttons {"OK"} default button 1
|
||||
do shell script "spctl --master-disable" with administrator privileges
|
||||
display dialog "Software assessments are disabled now!" buttons {"OK"} default button 1 with title "Information"
|
||||
on error
|
||||
do shell script "spctl --master-enable" with administrator privileges
|
||||
display dialog "Assessment enabled!" buttons {"OK"} default button 1
|
||||
try
|
||||
do shell script "spctl --status"
|
||||
display dialog "Error!" buttons {"OK"} default button 1 with title "Information"
|
||||
on error
|
||||
do shell script "spctl --master-enable" with administrator privileges
|
||||
display dialog "Software assessments are enabled now!" buttons {"OK"} default button 1 with title "Information"
|
||||
end try
|
||||
end try
|
||||
end try
|
||||
end script
|
||||
|
||||
set looping to true
|
||||
|
||||
repeat while looping = true
|
||||
try
|
||||
set spctl_status to do shell script "spctl --status"
|
||||
on error
|
||||
set spctl_status to "assessments disabled"
|
||||
end try
|
||||
|
||||
if spctl_status = "assessments enabled" then
|
||||
set spctl_status to "enabled"
|
||||
else
|
||||
set spctl_status to "disabled"
|
||||
end if
|
||||
|
||||
set dialog_action to (display dialog "Software assessments are " & spctl_status & "!" buttons {"Exit", "Toggle"} default button 2 with title "Software Assessments Toggle")
|
||||
set button_name to the button returned of dialog_action
|
||||
|
||||
if button_name = "Toggle" then
|
||||
run toggle
|
||||
else
|
||||
set looping to false
|
||||
end if
|
||||
end repeat
|
Loading…
Reference in New Issue