This works. It will run the next pattern and stop.
I initialize it with this gcode. It initializes a variable for current count and max count and runs the first file. Note that my test files had the homing commands in the files themselves. You could get rid of that $SD/Run command so it doesn’t run anything until you run the “next” gcode. If you did that, you would probably want to initialize _zendFileCount to 0 instead of 1 so next runs the first file.
#<_zenFileCount>=1
#<_zenFileMaxCount>=3
$SD/Run=ZenXY/pattern1.gcode
Then this is the “next” gcode. It adds to the count, resets to 1 if over the max, and runs the corresponding file.
#<_zenFileCount>=[#<_zenFileCount>+1]
o100 if[#<_zenFileCount> GT #<_zenFileMaxCount>]
#<_zenFileCount>=1
o100 endif
o101 if[#<_zenFileCount> EQ 1]
$SD/Run=ZenXY/pattern1.gcode
o101 elseif[#<_zenFileCount> EQ 2]
$SD/Run=ZenXY/pattern2.gcode
o101 elseif[#<_zenFileCount> EQ 3]
$SD/Run=ZenXY/pattern3.gcode
o101 endif