How to set Private record for multiple people

It was a simple script. It only really needs 1 line in statements. But the extras parts of the Script ensure that only “Selected objects” records will be affected, not “All objects” … which would be a disaster. And the “Expressions to display” means the Results section will have clickable rows that show both the original value and the value after running.

After installing the SuperTool add-on: in the Person View, run the ToolsIsotammi toolsSuperTool...
assuming that your saved the following as a text file named People_Privacy.script, use File → Open to open that saved script.

[Gramps SuperTool script file]
version=1

[title]
SuperTool-People Privacy

[category]
People

[initial_statements]
# A simple script to change the Gramps Privacy "padlock" Oct2022 # of selected Persons to locked
# completely UNSAFE. Make a backup before running
# source:    https://gramps.discourse.group/t/how-to-set-private-record-for-multiple-people/2885/3

[statements]
myinitprivacy = person.get_privacy()
person.set_privacy(True)
myendprivacy = person.get_privacy()

[filter]

[expressions]
name, myinitprivacy, myendprivacy

[scope]
selected

[unwind_lists]
False

[commit_changes]
True

[summary_only]
False

select some Persons in the Person view
Click the Execute