Jump to content

How to disable keys from keyboard?


EskoFIN
 Share

Recommended Posts

I have 2 keyboards. I want to launch macros etc. from the second keyboard. My script is otherwise complete but how can I prevent a key input from passing to the active application? For example, when I press "G" from the second keyboard and I have Notepad open, this character should not print to the screen.

Link to comment
Share on other sites

  • Moderators

EskoFIN,

This may give you an idea:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Thanks, my code is indeed based on that script. But if I understand correctly, that script only tells me which keyboard was used. The script does not block key presses. My problem is that I need to block all keys from the second keyboard so that those key presses will never get passed to the active application. How to block those keys, I have no idea.

I found some forum threads like the one below:

Apparently one user posted a code that worked but the code has been removed 😢

I'm wondering if it was a good idea to declare every key and key combination as autoit hotkey and then catch and inspect which keyboard was used. Probably not very nice solution though even if it worked!

Any ideas?

Link to comment
Share on other sites

Ok I have found a way.  Not perfect because it executes on Key-up (lags a bit).   There's a hint ;).

But I am not sure I am allowed to give the code here (do not PM me).  So, please clear this with the mod first.

Link to comment
Share on other sites

On 2/14/2021 at 11:00 PM, Nine said:

I finally decided to make a clean UDF out of it :

 

 

Thanks for your script! I have tested it during the week and the script is very nice! Though continuous key presses are not possible anymore (like you already said) and I have not yet figured out how to live without them. I'd especially need pagedown and pageup buttons so that I can use my Logitech R400 laser pointer as a remote controller in any software.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...