Updated selected glyphs in script

Hi everyone,
I have a script with a GUI which takes the selected glyphs and checks the tabular width, it works as long as the glyphs have been selected before running the script, but when I change the selection, the script is running through the first selection, is there a way of updating the selected glyphs in the script? Any hint will be much appreciated, thank you in advance.

Get the selection when you click the button, not when you start the script.

You could use metrics keys on the width of those numbers (e.g. to “zero”). Then you don’t need to check.

Thanks a lot! It worked!