thank you very much. I ran your script via Keyboard Maestro and got the following error message
2024-03-17 15:06:28 Execute a JavaScript For Automation failed with script error: text-script: execution error: Error: TypeError: Object is not a function (near ‘…}…’) (-2700). Macro “Generate Dropdown List of Tags” cancelled (while executing Execute JavaScript For Automation).