Skip to content

Autohotkey script to switch to tablet mode and lock keyboard and trackpad.

Notifications You must be signed in to change notification settings

Mercu7io/AutoHotKeyTabletMode

Repository files navigation

AutoHotKeyTabletMode

Autohotkey script to switch to tablet mode and lock keyboard and trackpad. This script is made for AutoHotKey v1.

Based on https://github.com/sophice/ahk-keyboard-locker and https://github.com/evilC/AutoHotInterception

How it work

The script show a menu in the tray to lock the keyboard and the touchpad. It also allow to change orientation. The orientation come back to landscape when the keyboard in unlock.


Setup

Install the Autohotkey v1

Install the Intereception driver

Download and install the Interception Driver
Note that you must run install-interception.exe at an admin command prompt (Not double-click it) - once you do so, it will instruct you to execute install-interception.exe /install to actually perform the install.

Enable the script

Right-click Unblocker.ps1 in the lib folder and select Run as Admin.
This is because downloaded DLLs are often blocked and will not work.
Alternatively, this can be done manually in one of two ways:

  1. By right clicking the DLLs, selecting Properties, and checking a "Block" box if it exists.
  2. Before you open any zip (ie the AutoHotInterception zip or the Interception zip), right click it and select "Unblock".

Device IDs / VIDs PIDs etc

I set by hand the keyboard ID to 2. You may need to chang it. To do it, find the device ID using the Monitor app.

Monitor App

This handy tool allows you to check if AHI is working, and also to find the VID/PID or DeviceHandle of your devices.
You can use the handy "Copy" buttons to copy the VID/PID or DeviceHandle of the device to the clipboard.
When using the monitor app, DO NOT tick all devices at once, as if it crashes, it will lock up all devices.

Run on windows Startup

Follow the guide from here https://www.thewindowsclub.com/autostart-programs-windows-10-make To begin with this, type Schedule Tasks in Start Search and hit Enter to open the Task Scheduler.

Under the General tab, give the Task a name, say NoUAC1, complete the other fields as required, and make sure that you check the Run with highest privileges box.

Trigger a task on system startup

Configure the setting under the Triggers, Action, Conditions & Settings tab according to your preferences. Under Triggers, you can set it to run when the computer starts every time. To do so, click on the Triggers tab, then click on the New button on the bottom left side. Now, select At startup in the Begin the task drop-down menu.

Define action for a scheduled task

Now, configure the Actions tab. Here, click on the New button available on the bottom left side, then select Start a program in the Action drop-down menu. Now, click on the Browse button and select the exe file of the program that you want to run with administrative privileges on your system startup.

Now, configure the Condition Conditions tab. If you are a laptop user, this step is important for you. In the Conditions tab, uncheck the following two checkboxes:

Configure Conditions tab Task Scheduler

Start the task only if the computer is on AC power Stop if the computer switches to battery power If you do not disable the two above-mentioned options, the scheduled task will only run when your computer is plugged in and charging.

You can read complete details about this in our post on how to create an elevated Shortcut to run a Program bypassing the UAC Prompt.

Once you have set up this task successfully, you will find that the program will start automatically with administrative privileges, every time your Windows PC boots.

About

Autohotkey script to switch to tablet mode and lock keyboard and trackpad.

Resources

Stars

Watchers

Forks

Packages

No packages published