• You are not logged in.
  • Index
  • Technical
  • Noob PKL question: how to disable (nearly) all keys + the mouse?

    Noob PKL question: how to disable (nearly) all keys + the mouse?

    • Started by pieter
    • 8 Replies:
    • Reputation: 2
    • Registered: 25-Oct-2013
    • Posts: 136

    Hi all, I am a long time reader, first time poster. I am a teacher. I'm a self confessed usability freak. On my own private computers I use linux with Colemak as my keyboard layout. At school in my office I use Windows + Colemak, thanks to Dreymar's wonderful Portable Keyboard Layout. Works great. :-)

    Now to my question: for some machines that I use in front of the class (Windows 7, Qwerty), I'd like the ability to switch between:
    - the normal state (normal functioning keyboard & mouse)
    - the 'locked state' in which keys & mouse do not work. As not even ctrl, alt & del will be working (at least not all 3 of them), students won't be able to go to the taskmanager and kill PKL.

    - of course I would need some hotkey to switch the program off. Something like RAlt & LAlt. 

    Background:
    - school machines run Windows 7
    - users (such as me) have to admin rights
    - recently, our sysadmins changed the Win 7 system, they (unintentionally) disabled the Windows screen lock function (Win+L). Now, the sysadmins are mostly nice guys. But like in most large organisations, they are not really responsive to user request
    - so, once more it is: portable solutions to the rescue!

    So - please enlight me on how to edit a pkl.ini file.  Also, I am very open to usefull shorts, hotkeys etc. Thanks! P.S. for the record, I did do my homework, I've puzzled a few hours on the pkl-files but now I need some help.


    EDIT: I changed the topic & this post; my previous solution was more complicated and needed a screen saver + PKL. But I think it can be done with PKL only, and this is the question I asked therefore.

    Last edited by pieter (25-Oct-2013 16:28:08)
    Offline
    • 0
    • Reputation: 214
    • From: Viken, Norway
    • Registered: 13-Dec-2006
    • Posts: 5,361

    PKL cannot kill the mouse and isn't really geared to kill all the keys (it's probably doable but tricky). I remember scripts on the Autohotkey site that could though. Problem with that is, you'd have to compile the functionality into the PKL source to ensure you only have one low-level AHK keyboard hook running or you'll run into some AHK trouble where you lose one or the other functionality depending on which program grabs the AHK hook.

    So generally, I'd say stick with your screensaver solution unless you're computer savvy enough to tweak the PKL source code. Or you don't need PKL on those school computers, in which case you should search and query the AHK forums and I'm sure you'll get help there!

    *** Learn Colemak in 2–5 steps with Tarmak! ***
    *** Check out my Big Bag of Keyboard Tricks for Win/Linux/TMK... ***

    Offline
    • 0
    • Reputation: 2
    • Registered: 25-Oct-2013
    • Posts: 136

    Thank you DreymaR. My ideal solution would be to have a portable (windows) version of xtrlock (which is a light Linux locker). Via PKL I hoped to get a similar solution. And yes I do need PKL, because I need admin rights for AHK which I don't have.

    (off topic remark: why don't corporate IT departments COOPERATE with "power users" like me? )

    Anyway, I'll look into the source code of AHK. See if I can cross compile it (that is: compile a windows program on my Linux machine; compiling is no problem but I have never compiled for or on Windows machines - I switched to Linux long ago because I found Windows too hard and Linux much more logical ). Perhaps easier is to dive into the hell hole of freeware (I'm used to the clean Linux repository world) and find a free portable screen locker, AND combine that with (PKL) disabled alt/ctrl/del keys, to prevent students from going to the task manager........

    Thanks again DreymaR.

    Offline
    • 0
    • Reputation: 214
    • From: Viken, Norway
    • Registered: 13-Dec-2006
    • Posts: 5,361

    Some IT departments do, but it takes the right kind of IT people who actually want to put in an effort.

    AHK doesn't need admin rights; you can run it portably. PKL is nothing more than compiled AHK code and you can run that, qed.

    You don't need to recompile AHK! Just Farkas Máté's PKL code. He's been very tidy with variable names (only a few globals in the entire code) so it shouldn't be too hard if you're so inclined. You'll need to add a mouse hook, and I'd think the easiest way is to intercept PKL's keyboard hook analysis to add your "safe mode" mostly null remapping. PKL by default lets through anything that isn't remapped, and you want to stop anything but the release combo.

    If you somehow did manage to devise a way of cross compiling AHK for Linux you'd be beatified. But that's a fairly major undertaking as AHK is heavily based on Windows system calls that don't easily port to Linux.

    Last edited by DreymaR (28-Oct-2013 09:47:59)

    *** Learn Colemak in 2–5 steps with Tarmak! ***
    *** Check out my Big Bag of Keyboard Tricks for Win/Linux/TMK... ***

    Offline
    • 0
    • Reputation: 2
    • Registered: 25-Oct-2013
    • Posts: 136

    I was not clear on the compiling part, with cross compile I meant that I use my linux machine to compile a program for a windows machine, I did not mean that I adapt the program for use on linux machines).  But again, I'll look into PKL code, Thanks again, DreymaR !

    Offline
    • 0
    • Reputation: 214
    • From: Viken, Norway
    • Registered: 13-Dec-2006
    • Posts: 5,361

    Ah, I see. However, all you need do is run the ahk2exe.exe (which probably runs on Wine?) from the AHK site, on FMáté's source which you'll find at a repository (git?). Unfortunately the most current version of PKL is 0.4beta(?) and the most updated source I've found is .35 iirc. Too bad this beauty didn't get any more development although he's certainly not been too bold with the version numbering as the current version seems finished enough to me and very stable!

    *** Learn Colemak in 2–5 steps with Tarmak! ***
    *** Check out my Big Bag of Keyboard Tricks for Win/Linux/TMK... ***

    Offline
    • 0
    • Reputation: 2
    • Registered: 25-Oct-2013
    • Posts: 136

    It works!  This morning I browsed on the Autohotkey sites, read some man pages, and wrote an unelegant, but working, script. All keys and all mouse buttons get ::return  (meaning that they do not give input to the computer) except for a few modifiers. A modifier combination gets ::ExitApp  (meaning they end the script's running, meaning that afterwards the keyboard & mouse key function normally again.

    Then I borrowed my wife's windows-laptop, downloaded Autohotkey, tested the script and then compiled it, which can now be done within Autohotkey itself and has an idiot-proof menu. Even I can do it! ;-)  By the way, I think that it is not really compiling (=translating higher level code into lower level code) but I think it is just "making portable". Anyway, you end up with a windows .exe file that does not have to be installed and can be run as a user (!).

    How does "my" little program work?  
    - Copy the .exe file on your PC  (let's say on drive D:\). Click it, and the script will run.

    What does it do?
    It blocks all keyboard and mouse keys. So, you can still see the screen, you can move the mouse and even see the pointer, but if you click or if you push a key, nothing happens. (This resembles the (linux) screenlocker xtrlock).

    What is this bad or good for?
    This is a bad solution if you want to protect " sensitive" information from nosey people. But for my use it is very good: as a teacher I often show students things on a big screen (assignments, Youtubes, Powerpoints etc.) and they may (they must!) see that. But I don't want them to look up other things on that computer, or to access my files and so on. Now I can show them an assignment and walk away for 5 minutes without having to guard the PC all the time.

    How does the script stop?
    - By entering the secret modifier combination

    What does ctrl-alt-del do?
    - This Windows key combination behaves remarkable. Despite me having "muted" the ctrl, alt and del keys, the combo still works, meaning tghat it overrides the AHK script. Next, you can even start the task manager. My fear was that a clever student could then see the script running, kill it, and have access to the machine, but the crazy thing is that yes, I can open the taskmanager, but then the mousekeys & keyboard keys stop working again, so I cannot kill anything. Couldnt even get to the screen that shows all running processes.....

    To do:
    - test on school computer
    - important: see how I can block the input from the Smart Board (!) I forgot this, but we have smart boards, which are like tablet screens. If I click on a button on that screen, it is like I pressed it with a mouse. The smartboard is actually some sort of mouse, I hope that it is blocked (if not I'll have to dive in again).


    Well, this wasn't to hard :-)  :-)

    Last edited by pieter (29-Oct-2013 14:44:01)
    Offline
    • 0
    • Reputation: 214
    • From: Viken, Norway
    • Registered: 13-Dec-2006
    • Posts: 5,361

    Ctrl-Alt-Del is kinda hardwired. What a really crafty student could do would be to hold in those keys until the machine reboots. But then they couldn't log on again I suppose! :)

    Grats on your success! I hadn't thought about only blocking the mouse keys; of course that's enough. Now, if you want to combine this with PKL you'll have to bake it into the PKL code as mentioned.

    *** Learn Colemak in 2–5 steps with Tarmak! ***
    *** Check out my Big Bag of Keyboard Tricks for Win/Linux/TMK... ***

    Offline
    • 0
    • Reputation: 2
    • Registered: 25-Oct-2013
    • Posts: 136

    Yep, it works great. The smartboard is also blocked, it looks like the input of the board is interpretated as mouse clicks, as I hoped. I may as you say include this script into PKL.

    What I would also like is some sort of visual clue that the script is running. This also deters people from trying to do stuff on the computer. I was inspired by xtrlock, the minimalistic linux locker, which does the same: it lets people see the screen, but blocks all user input. In xtrlock you can move the mouse, but you cannot scroll, click or use the keyboard. The visual clue xtrlock gives, is that the mouse pointer is replace by a blue lock. If you move the mouse, the blue lock moves. I will see if I can imitate that with AHK.

    Last edited by pieter (30-Oct-2013 13:46:09)
    Offline
    • 0
      • Index
      • Technical
      • Noob PKL question: how to disable (nearly) all keys + the mouse?