If I understood right what you're trying to do is already possible with marker actions.
You need to install the sws extension to use it.
http://forum.cockos.com/showpost.php...2&postcount=19
basically marker actions work like this:
http://forum.cockos.com/showpost.php...6&postcount=12
note:
The marker actions are now included in the SWS extensions (see first link), so no need to download and install the reaper_markeractions.dll.
Further down the thread there are also some ideas of how marker actions could be used.
http://forum.cockos.com/showthread.php?t=24297