Disable mouse with timer.

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
ozzynotwood
Posts: 30
Joined: 16 Nov 2017, 19:19

Disable mouse with timer.

16 Nov 2017, 19:43

Hello

Can I please have some help with this?

I'm in need of some AHK code that will disable my mouse for a set amount of time.

If I had to describe in simple English what I needed:
1. Disable mouse for 30 minutes.
2. Re-enable mouse.
3. Exit (so that if I run it later I'm not running into any conflicts with the first instance running.


The reason is, when my scheduled backup is running, I don't want someone coming and disturbing the computer while it's backing up.I still want use of the keyboard for when I need something ASAP.

I don't need the AHK script to have a start time, this will be handled by Windows Scheduled Tasks, just need to to have a duration
I don't mind if the timer is set by seconds or minutes. Hours wouldn't be suitable.
Compatible with W7 and W10
User avatar
Exaskryz
Posts: 2882
Joined: 17 Oct 2015, 20:28

Re: Disable mouse with timer.

17 Nov 2017, 03:52

Hmm, this is very tricky to test. But here are readings and steps you should walk through:

Auto-Execute Section. We need to execute commands as soon as the script is launched.

SetTimer should be used to execute a Label that will use the ExitApp command to close the script. We want to start the timer as soon as the script is launched.

We will make Hotkeys for the mouse buttons - See KeyList.

To make the Hotkeys do nothing, make them only use the return command. This is effectively disabling the keys.

I highly recommend making a Hotkey for ExitApp so you can end this script early. Like use Ctrl+Esc hotkey: ^Esc::ExitApp.

Finally, if you'd like, you can also use BlockInput to stop Mouse Movement. Be careful that you don't disable the Keyboard as well! Read that document thoroughly.

(As a side thought - could it be possible to unplug the mouse to prevent people from interfering?)
ozzynotwood
Posts: 30
Joined: 16 Nov 2017, 19:19

Re: Disable mouse with timer.

17 Nov 2017, 07:37

I'm not winning with this one, I'm not a script writer, I just copy/paste/edit scripts I find, can anyone make one for me?
User avatar
Micromegas
Posts: 260
Joined: 28 Apr 2015, 23:02
Location: Germany

Re: Disable mouse with timer.

23 Nov 2017, 04:16

Sure. What is it worth to you?

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: mikeyww, prototype_zero, w_i_k_i_d and 317 guests