Handle item selections more safely

Allow to see item selection if command is run from browser, i.e.
user actually selects items and runs command from menu or action
dialog.

In such case, selected tab is also set as current in script.
itemtags: Make itemtag script functions more useful
itemtags: Add commands for user-defined tags