Select random image from file list

16 views
Skip to first unread message

nmyshkin

unread,
Dec 13, 2025, 12:07:22 PM (2 days ago) Dec 13
to Tasker
I adapted this from an earlier post I've now lost track of. It seems OK to me, but fails right at the second step, giving "0" for %num (should be "5" in my working case). I've inspected %files and it consists of a list of the files in the directory. What am I doing wrong?

Run Shell Command: ls /sdcard/.dicThumbs Store In: %files
Variable Set %num Value: %files(#)
Variable Randomize %rand Min: 1 Max: %num
Write File File: covers/1.png Text: %files(%rand)

João Dias

unread,
5:19 AM (13 hours ago) 5:19 AM
to tas...@googlegroups.com
You can easily select a random item from an array like this: %files(*)


Hope this helps!

   Join: connect multiple devices (send pushes, remote SMS, notifications) on Android, Windows, Mac, Linux
   Tasker: customize/automate anything on your phone!
   AutoApps: add advanced functionality to Tasker via plugins

     

João Dias

Reply all
Reply to author
Forward
0 new messages