Use toggle Switch to Send Keystroke
The last solution you have linked can work as expected for your application. I simply ran it through falstad with normal XOR gate and it works as expected. But XOR gate with Schmidt trigger input is highly recommended.  

 


  When the toggle switch is flipped from off to on AND from on to off,
  allow a momentary connection across the keyboard contacts


Any level change on the input pin (OFF to ON or ON to OFF) creates a short pulse on the output Pin (output of XOR Gate) 
The output can be then used to drive a MOSFET or other similar component to close the keyboard contacts.  

The pulse width can be varied by varying the value of \$R1\$ and \$C1\$. Exact values of \$R1\$ and \$C1\$ can be attempted to calculate based on datasheet of the EXOR gate used. as of now, trial and error method should work.  



A simple LTSpice simulation

Green is input voltage, RED is voltage across capacitor and Blue is the output voltage.