If mapkey execution is not waiting for the render to complete, I'm not sure it would be any different for a trail* file. If so, time to drag AutoIT onto the playing field.
Trail files are very similar to mapkey files, so if you are understanding mapkeys, trail files will also be understandable.
The main difference is that mapkeys are limited in length** (I forget how many characters) but can call other mapkeys. I think trail files cannot include mapkey calls - when a mapkey is used, only the mapkey expansion is recorded in the trail file. I have used mapkeys in the creation of baseline trail files to avoid typos and mis-picks and the like, but never noticed any way to embed them.
*Changing the trail file suffix to txa causes the software to assume it is a training file and it won't exit if there is an error in running it.
**Perhaps this is to prevent cross pollination. The educational versions didn't allow recording or playback of trail files, presumably to prevent re-creating educational models from the commercial version's trail files. If mapkeys were unlimited in length the method could be used to circumvent commercial/educational license restrictions.