They are super easy for inbuilt Reaper actions. Transport: Record has the ID 1013 in the main section of the action list. You just write a script that triggers the action with that ID.
The short version:
Code:
RPR_Main_OnCommand(1013, 0)
the slightly longer version I use, because it's clearer what it does without looking up the number:
Code:
TRANSPORT_RECORD = 1013
RPR_Main_OnCommand(TRANSPORT_RECORD, 0)
That's all there is to it. Save that as *.py file, enable ReaScript in Reaper and import the script in the MIDI editor section of the action window. Assign a toolbar button - done.
One downer to it: The toolbar button won't change its state visibly.
SWS or other extension actions afford a line more to work reliably. Example:
"SWS/FNG MIDI: show only used CC lanes" has the Custom ID "_FNG_SHOW_USED_CC_LANES". The script needs to use that instead of the Cmd ID number to work reliably across systems. The script looks like this:
Code:
Used_CC = RPR_NamedCommandLookup('_FNG_SHOW_USED_CC_LANES')
RPR_Main_OnCommand(Used_CC, 0)