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"