Display Random Files

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
jdev21
Posts: 45
Joined: 08 Oct 2014 22:13

Display Random Files

Post by jdev21 »

I would like to click a button or catalog item to display a certain amount of random files (5,10, or 20) in the current directory. Each time its clicked it shows a new random set of files. Is this possible to do?

highend
Posts: 13313
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Display Random Files

Post by highend »

Code: Select all

    filter;
    $allFiles = listpane(, , 1+4);
    $amount   = gettoken("5|10|20", rand(1, 3), "|");
    $files    = gettoken(formatlist($allFiles, "x"), $amount, "|", , 1);
    filter "$files", 1+4;
The same could be done with the help of a paperfolder but I guess the visual filter solution is sufficient?
One of my scripts helped you out? Please donate via Paypal

Post Reply