I'm sorry, I've extracted this script from my big IDC file and forgotten to add #include <idc.idc> at the beginning.
The script won't take care of the tags. But why do you need it? Press SHIFT-F12 and you'll get all the tag strings there. Or look for the tag string of interest using Alt-B.
Then you can find the tag table entry of interest by searching for the tag string address (Alt-B).