AutoHotkey to disable specific user keys

Source: Internet
Author: User

Every Spring festival holiday, cousin they are very fond of using my computer to play 4399 and other sites of small games, because these people often press asdf key, my keyboard has changed several. There is no way to realize the cousin log on to the computer when these keys are invalid, their own login is not affected by the method.

"Problem-solving ideas"

There are already people in the magazine who have provided solutions through proprietary software, and today I offer another way of thinking. AutoHotkey is a hot-key scripting language under the Windows platform, which is mainly used to implement the keyboard and mouse auto-key function, and to map and screen some keys is a piece of cake. In conjunction with the system's task scheduling function, it is possible to automatically block certain keystrokes after a specific user logs in. The benefit of this scenario is that you do not have to install a software specifically for a particular feature. AutoHotkey is different, the shielding button is only one aspect of its flexible application.

"Method of solving problems"

First download AutoHotkey, but here I recommend the "Ahk lazy package", which comes with some good script, convenient for users to learn and use. Unzip the downloaded "AutoHotKey lazy pack. 7z" to any location, running the Ahk2Exe.exe to be used (located in the "AutoHotKey Lazy bag AutoHotKey Chinese version Compiler" directory).

Next, open Notepad and write the following script:

#NoTrayIcon

A::return

S::return

D::return

F::return

Line 1th "#NoTrayIcon" code allows the script to run without displaying the notification area icon, otherwise it will display a green H icon in the notification area. This is to avoid being used by the computer people found, which may abort the script, causing our purpose to fail. The 2nd to 5th line means to map the asdf four keys to "return", which can be understood as having no action after pressing the keys. If you also want to block other keys, you need to follow the key name specified in the AutoHotkey, you can refer to the Help document included in the package (under the "Key List" link).

Click "file → Save as" to change the save type to "all types (*. *)" and "Disable Asdf.ahk" in the "File name" column (the file name can be filled in freely, but the extension must be ahk, the other side should be in double quotation marks).

Next switch to the Ahk2exe program window, click the "Browse" button after "Source" and select "Disable Asdf.ahk". Then click the "Browse" button after "Destination" to select the location where the executable script file is saved and the file name. For example, I deliberately named the generated EXE file Svchost.exe (Figure 1) in order to make the script more confusing. Click the "Convert" button at the bottom to generate the executable script file.

Tips:

Svchost.exe is the generic host process name for a service that Windows systems run from a dynamic-link library (DLL), and after a user logs on to the system, there are often multiple Svchost.exe processes that ordinary users do not dare to end at random.

Place the generated Svchost.exe file in a more secluded location, then switch to the user (i.e. switch to the account used for "cousin"). Under this account, open Control Panel → administrative tools → task Scheduler, and click Create Basic task in the Actions panel on the right, and the Create Basic Task Wizard interface opens. A total of 5 steps: The first step, fill in the name and description of the task plan; the second step, "When do you want this task to start", select "when current user is logged on", and the third step, "What do you want the task to do?", select "Start Program", Fourth step, click "Browse" button, Select the Svchost.exe file that you just generated; 5th, the system will show a summary of the task plan, confirm the error, click "Finish" button.

Log off the current user and then log back in, at this point, pressing the ASDF button will not play any role. When "cousin" wants to play the game again, tells him these several keys already "bad", he also has no way.

Tips:

Experienced users do not need to switch accounts, you can directly click on "Create Task" to create a task and specify the effective user.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.