This is pretty straightforward. Simply make the window you want to use as the source for your collect your active window. E.g. if you want to collect your files from a timeline, make sure your timeline is your active window. If you want to collect files from multiple sources, e.g. 2 bins and 3 programs, make sure your Project only contains these elements, and make your project window your active window.
Then use the "collect files" command, select a target folder on a drive with enough space and let it do its thing. The command will not only place all the necessary media files in the new folder, it also will place a copy of your timeline there.