elindo 0 Posted February 1, 2015 Report Share Posted February 1, 2015 Can we pick a random file that contains random items? I know we can add a list of items that can be picked randomly, but taking a step forward, is it possible to add a list of files and each file would contain their own list of different items? Say... Pick random: A, B, C Then go automatically to A 1, 2, 3, or B 1, 2, 3, or C 1, 2, 3. I am trying to keep the program short. Quote Link to post Share on other sites
dyvel 20 Posted February 1, 2015 Report Share Posted February 1, 2015 If you load the filenames into a list, then pick random list item. Then you have your random filename - open the file using the filename and your location and load it into a new list... 1 Quote Link to post Share on other sites
elindo 0 Posted February 1, 2015 Author Report Share Posted February 1, 2015 Is there an open file command? or open folder? Quote Link to post Share on other sites
dyvel 20 Posted February 1, 2015 Report Share Posted February 1, 2015 There's a read file command - see http://wiki.ubotstudio.com/wiki/$read_file Quote Link to post Share on other sites
elindo 0 Posted February 1, 2015 Author Report Share Posted February 1, 2015 I know this is wrong as it can be... I am trying to navigate to a random site picked from a random file.. ui open file("Files", #Files)add list to list(%files,$list of files("1.txt2.txt3.txt",$new line),"Delete","Global")add list to list($random list items($list of files), "delete, "Global" navigate($random list item(%links),"Wait") UI commands seem to open files only, but no open folders to load. from there I am looking to open a random to file to work.. ... and then continue with the program.. Quote Link to post Share on other sites
deliter 203 Posted February 1, 2015 Report Share Posted February 1, 2015 as in,a,b and C are not files but actually folders?or a,b,c are files,and in those files you want to randomly pick attributes from those files? both are possible,use the $get files parameter of the root folder if they are folders,followed by another $get files and randomise ituse find regular expression if they are files Quote Link to post Share on other sites
elindo 0 Posted February 1, 2015 Author Report Share Posted February 1, 2015 Yes... I should of have said ui open folder ("Folder", #Files) A, B, C, would be files in a folder... You would open a folder that contains different files.. Then, randomly open A, B, C... which would contain a random item to go to.. Quote Link to post Share on other sites
Gogetta 263 Posted February 2, 2015 Report Share Posted February 2, 2015 If you want to select a folder using the UI commands I would suggest using Aymen's File Management Plugin here. The function you will want to use is the $folder browser dialog. If you then want the script to select a random file from the selected folder you can use the $get files function and add the filenames to a list. Example: (requires the file management plugin) ui button("Select a Folder") { set(#c_folder, $plugin function("File Management.dll", "$folder browser dialog"), "Global") clear list(%files) add list to list(%files, $get files(#c_folder, "Yes"), "Delete", "Global") alert("Random File: {$random list item(%files)}") } Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.