Copying number of selected files in a lister to clipboard

I'm trying to code a button that can read the number of selected files in a lister, and copy that number to the clipboard so that the number can be read by an external program.

For example, if 5 files are selected, the value stored in the clipboard would be set to "5".
If no files are selected, the value stored in the clipboard would be set to "0".

From what I saw when looking at other posts in this forum, "clickData.func.sourcetab.selected_files.count" seems like it might help, but I'm not sure how to get the value returned by that to be stored to the clipboard. :sweat:

DOpus.SetClip lets you set the clipboard from a script. (There's also Clipboard SET which can be used outside of scripts.)

The bottom of Commands to copy selected filenames to the clipboard has an example of how to set the clipboard in a script.

That helped me make it do exactly what I needed. Thanks for pointing me to the right place, Leo! :slight_smile: