The easiest thing would probably be to have the user create a hotkey with "onRelease" using the PTT key.
Can utilize requestHotkeyInputDialog and getHotkeyFromKeyword to make sure it's an on release hotkey and to check if it already exists.
Then do what you need to in the relevant event function.
Only other way I could think of would be to try and detect key presses on your own and then do things, all while being careful not to mess with the client's operation.
When sending PMs please make sure to include a reference link to the thread in question in the body of your message.