powershell screen with dynamically built buttons call a function based on the button clicked
I’m 4 years retired, converting a routine I wrote umpteen years ago in VBScript.
This portion of the script, reads the contents of a folder,
Then builds a screen, with buttons for each TXT file found in that folder.
When a button is clicked, it calls a common routine.
I would like the name of the button (button.text, to be passed to the common routine)
But the common routine is being called only with the name of the last member found, not the member that has been clicked.