Just modify the Paul's code :
For example, add "out1 = 1;" after "LogTextMessage("pin: [%i] was just touched", i);" (line 116) and "out1= 0;" after "LogTextMessage("pin: [%i] is no longer being touched", i);" (line 125).
Then connect out1 outlet of the script object to an adsr envelope.