I've been trying the same thing and eventually settled for making a template RPP project (see attachment) in which I replace a few placeholders with a PHP script and then render that template.
This is the important section of the PHP script, you need
http://valentin.dasdeck.com/php/midi/ for it:
Code:
require_once('/MIDI/classes/midi_duration.class.php');
$midi = new MidiDuration();
$midi->importMid($dir . "score.mid");
$rpp = file_get_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'template.RPP');
$rpp = str_replace('{{LENGTH}}', $midi->getDuration(), $rpp);
$rpp = str_replace('{{BPM}}', $midi->getBpm(), $rpp);
file_put_contents($dir . "score.rpp", $rpp);
$reaper_batch = $dir."score.rpp\n" .
"<CONFIG\n" .
" <OUTFMT\n" .
" bDNwbUABAAABAAAAAAAAAP////8EAAAAQAEAAAAAAAA=\n" .
" RSMODE 9 0 1\n" .
" DITHER 3\n" .
" PAD_START 0.0\n" .
" PAD_END 1000.0\n" .
" OUTPATH "".$dir.""\n" .
" >\n" .
">";
file_put_contents($dir . "job.txt", $reaper_batch);
system(""$reaper" -noactivate -batchconvert "" . $dir . "job.txt"");
Obviously you need to adjust the config to your preferences, but this might help a bit further.