Disable or change hotkeys?

Ask general questions here.
mrt
Posts: 257
Joined: Mon Mar 16, 2020 11:31 am

Disable or change hotkeys?

Post by mrt » Fri Oct 15, 2021 7:16 am

Dear folks,

I was wondering if it possible to change or completely disable the global hotkeys?

Currently I am running a console application on a remote machine, where it watches and only seldomly does tasks - but the machine is in use by some human at the same time.
Therefore it happens, that the human hits the <End> button e.g. while renaming something in Windows Explorer which then does not work and also pauses the test execution.

Best would be to change this to something else (e.g. Ctrl+End or similar) or to disable hotkeys completely.

I searched Ranorex settings, Solution properties, Test Suite properties but did not find any useful section.
Any ideas?

thanks!

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Disable or change hotkeys?

Post by odklizec » Fri Oct 15, 2021 9:00 am

Hi,

You can define the abort key via this line placed in program.cs (before initializing test). Simply change Pause with whatever you prefer.

Code: Select all

Keyboard.AbortKey = System.Windows.Forms.Keys.Pause;
Ideally, the machine should not be used by anyone else during the test run! I would even recommend to disable mouse and keys input, via these lines (and re-enable them at the end of test)...

Code: Select all

Mouse.Enabled = false;  
Keyboard.Enabled = false;  
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

User avatar
Stub
Posts: 515
Joined: Fri Jul 15, 2016 1:35 pm

Re: Disable or change hotkeys?

Post by Stub » Fri Oct 15, 2021 9:16 am

Oooo, that's a great tip! That helps me out here too. Thanks for that one.

mrt
Posts: 257
Joined: Mon Mar 16, 2020 11:31 am

Re: Disable or change hotkeys?

Post by mrt » Mon Oct 18, 2021 6:51 am

Hey, ahh thats nice, thanks.
odklizec wrote:
Fri Oct 15, 2021 9:00 am
Ideally, the machine should not be used by anyone else during the test run! I would even recommend to disable mouse and keys input, via these lines (and re-enable them at the end of test)...
Yes, ideally. :)
In this case it is no real test, it is just a small watcher script that watches a certain browser tab and clicks once after 30 mins and then again after ~60mins, so the machine is almost free in between.
I know it is not ideal, but setting up a fresh machine for doing 1 click per hour also doesn't seem good. ;)