As the name implies, this script inverts the selected layer (i.e., deselects the selected layers, and selects the unselected layers). It's hard to believe this isn't already a native Photoshop command!
Download
To download this script, right-click (Ctrl-click on the Mac) on the appropriate version below, and choose "Save Target As".
Invert Selected Layers
Version: 0.2.0 (August 26, 2016)
Requires: Photoshop CS3+
Downloads:
ZIP
Installation
Download the script(s), and copy it into your "Adobe Photoshop ##/Presets/Scripts
" folder.
After restarting Photoshop, the script should appear in the File » Scripts menu.
For more detailed instructions, see the Installing Scripts section of the Scripting Photoshop, Part 1 tutorial.