Expand Folders Command

can i set just one hotkey with this script to expand and collapse (if there is expanded but nothing selected) folders as in your beatiful code from here