Change visible status of single volumes

Hide or show single volumes on desktop

tell (button returned of (display dialog "Change visible status of single volumes" buttons {"Cancel", "Make invisible.", "Make visible."})) to set {isVisible, visText} to {it is "Make invisible.", word 2 of it}
tell application "System Events" to set {diskList, startDisk} to {(get name of disks whose visible is isVisible and local volume is true), name of startup disk}
if diskList is {} then display dialog "All volumes are " & visText buttons {"Cancel"} default button 1 with icon caution
set chosenDisk to (choose from list diskList with prompt "Choose a volume to make " & visText) as string
if chosenDisk is "false" then return
if chosenDisk is startDisk and isVisible then
	if (button returned of (display dialog "Do you really want to hide" & return & "the startup volume?" buttons {"Yes", "No"} default button 2 with icon stop) is "No") then return
end if

quit application "Finder"
tell application "System Events" to set visible of disk chosenDisk to not isVisible
delay 1
launch application "Finder"

Nice, but doesn’t hide the chosen volume if it’s in the sidebar, of course

Perhaps not typical, I don’t keep disks on the desktop; only in the sidebar where I have:

Computer
Hard Disks
Connected Servers
Removable Media

Desktop
Home
Applications
Documents
Scripts
Downloads
Pictures.

I almost never look at Computer, so almost never see a disk icon in a Finder view.

I have two disks, which I hide temporarily with this script. I disabled these disks manually in Finder Preferences to hide them permanently in the sidebar.
Disks are also hidden in Computer, if they are hidden on desktop