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)