About BlockInput and KeyHistory

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Uzume
Posts: 2
Joined: 24 Aug 2017, 01:54

About BlockInput and KeyHistory

24 Aug 2017, 03:15

I'm currently using this blockinput command:

Code: Select all

Alt & Esc:: Blockinput, % "O" ( ( Lock := !Lock ) ? "n" : "ff" )
What it does is basically toggle BlockInput On/Off by pressing Alt + Esc. I'm using it to prevent my roomate from "hacking" my PC whenever i leave it and go to do stuffs. But sometime i forgot to turn BlockInput on before leaving and..... yeah.... :facepalm: So i try to step it up a bit, and my question is:

Is there a command to auto turn on BlockInput on if KeyHistory hasn't received any action (keystroke, mouseclick) after a period of time (i.e 2 minutes)? In other word, after 2 minutes of inactivity, BlockInput will be auto turned on and can be turned off later by a key, e.g Ctrl + Esc or sth like that.

Note that i'll use this new command (if it exists) along with the old blockinput command so i hope they won't clash each other

Mini question: This may sound trivial, but i just wanna confirm: KeyHistory can only track keystrokes and mouseclicks, not mouse movement right?
User avatar
DyaTactic
Posts: 221
Joined: 04 Apr 2017, 05:52

Re: About BlockInput and KeyHistory

24 Aug 2017, 07:14

With SetTimer you can check the time the user did nothig. This includes mouse movements.

Code: Select all

; In the AutoexecuteSection:
TimeToBeIdle := 60000 * 2	; Set the requiered idle time to 2 minutes.
SetTimer, CheckIdleTime, % TimeToBeIdle

Return	; End of AutoexecuteSection

CheckIdleTime:
	If (A_TimeIdle > TimeToBeIdle) AND (Lock = 0) {
		Blockinput, % "O" ( ( Lock := 1 ) ? "n" : "ff" )
	}
Return
Is this something you searched for?
Uzume
Posts: 2
Joined: 24 Aug 2017, 01:54

25 Aug 2017, 23:15

It didn't work at first. After some changes, it worked a few times, oddly enough, but then back to not working again. I'll keep looking into it, thanks for your help anyway

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: ht55cd3 and 239 guests