You can't write programs on the rigol itself like that, as far as I can think of.
You will need to use something like python, matlab, etc. to grab a chunk of sample memory from the scope (USB/ethernet), analyze it on the PC, then repeat. You will have a lot of dead time, but up to you if that matters. You can find some samples of communicating with the scope on this forum.
Depending on the bandwidth you could use a DAQ, raspberry pi with external ADC, etc. to do this as well.