Most MIDI applications recognize CC64 with value of 127 as sustain on and value of 0 as sustain off.
The attached takes the incoming key message (in this case F12 key down) and sends CC 64 value 127.
When you release the F12 key, it will send CC64 value 0.
You may want to assign the incoming keystroke to a different key as whatever key you assign will not be suppressed by the operating system. You can assign keys not on your keyboard with the Special Key dropdown list on the incoming action.
If you application recognizes different MIDI for sustain, you can also re-assign the outgoing actions accordingly.
Bome Customer Care
Also available for paid consulting services: email@example.com