I want to use a function from my Powershell script by triggering a global hotkey (the combination Ctrl+Shift+F12) which is registered and unregistered by my script. I need to access a .NET object created by my script. In pseudo code:
$object_i_need = New-Object SomeClass
register_hotkey "Ctrl+Shift+F12" hotkey_func
function hotkey_func { do_something_with $object_i_need }
wait_for_keypress
unregister_hotkey
Is this possible somehow?