Page 1 of 1

Use keypress to trigger script

Posted: Thu Apr 17, 2014 9:28 am
by daviesg6
I have created a form with multiple PowerShell scripts available to the user (primarily searches for AD objects). Each of these has the option to run and display on screen or export to file via buttons.

I would like to improve this by allowing users the option to hit a key (enter for example) to run the script. Is there a way I can do this? I know it is possible to use this option if there is a single button, but I can't work out how to do this for multiple options.

Is there a way to do this :?:

Re: Use keypress to trigger script

Posted: Thu Apr 17, 2014 9:53 am
by jvierra
There can only be one default action per form. The enter key is assigned to the defined default.

You can handle all keys and detect the enter key and have it do anything you want but it has to be hand coded.

Re: Use keypress to trigger script

Posted: Thu Apr 17, 2014 9:57 am
by daviesg6
jvierra wrote:There can only be one default action per form. The enter key is assigned to the defined default.

You can handle all keys and detect the enter key and have it do anything you want but it has to be hand coded.
Thanks, kind of figured that was the case but wanted confirmation. I'll leave it so the users have to use the mouse to hit the button they want to use.