@dc42 I'm having some trouble figuring out how to randomly select a file from the /gcodes/ folder. Do I have to put the files names in that folder in an array, or is there a way to declare the contents of the /gcodes/ folder as an array? I currently have about 200 gcode files stored in the /gcodes/ folder, and I add more files to it as I generate them.
I typically run a macro at the end of the config.g file, like this:
M98 P"/macros/macro01"
And that macro file looks like this (though much longer):
; file name: macro01
M98 P"/gcodes/wipe_03.gcode"
M98 P"/gcodes/file_04.gcode"
G04 S60
M98 P"/gcodes/wipe_01.gcode"
M98 P"/gcodes/file_02.gcode"
G04 S60
M98 P"/gcodes/wipe_02.gcode"
M98 P"/gcodes/file_06.gcode"
.
.
.
Should macro01 file look like this:
; file name: macro01
var myfile = {"file_01", "file_02", "file_03", "file_04", "file_05", "file_06"}
M98 P"/gcodes/^myfile[random 6]^.gcode"
G04 S60
M98 P"/gcodes/^myfile[random 6]^.gcode"
.
.
.
It seems like I'll quickly run out of line length if I try to put all 200 file names in the variable declaration.
Another idea- rename all the files in the gcodes folder with simple numeric names:
1.gcode, 2.gcode.... 212.gcode
Then in the macro file, select a random pattern file like this:
M98 P"/gcodes/^{random(212)}^.gcode"
Sorry if this stuff is too basic. I've been away from programming for a looooong time.