Concerning OP:
Code: Select all
#singleInstance force
#persistent
#include *i <Lib_1>
setTimer,idleCheck,10
setTimer,tool,10
return
tool:
;tool(getTimeIdleNoMouse())
tooltip % getTimeIdleNoMouse()
return
idleCheck(){
global _idleTick
if(!_idleTick)
_idleTick:=a_tickCount
input,c,L1VMI,{backspace}{LControl}{RControl}{LShift}{RShift}{Appskey}{Up}{Down}{Left}{Right}{Capslock}{Printscreen}{home}{end}{pgup}{pgdn}{LAlt}{RAlt}{ins}{del}{pause}{break}
_idleTick:=a_tickCount
}
getTimeIdleNoMouse(){
global _idleTick
return a_tickCount - _idleTick
}
~LButton::
~RButton::
~MButton::
~WheelUp::
~WheelDown::
~XButton1::
~XButton2::
_idleTick:=a_tickCount
return
This isn't perfect, certainly. It won't get key-up events, so if you were to say, click and drag something, it would only reset upon the first key-down event. I also didn't add
all keys to the endkeys list that
could be there, such as media keys. And, it's a bit intrusive, not being confined to a single function. You COULD get away with two functions: the first being idleCheck(), and the second being a reference for all the hotkeys (to do nothing). However, you could double-up on the second function, allowing an optional parameter. If the parameter has content, it could return the idleTime. Somewhere though, you'd have to loop through all the hotkeys and set them, possibly in a similar fashion to the if-statement in idleCheck().
For it to act like A_TimeIdle rather than A_TimeIdlePhysical, remove the I option for the input command.
Edit:
Code: Select all
#singleInstance force
#persistent
#include *i <Lib_1>
#hotkeyInterval 200 ; necessary for hyper-scrolling wheels
setTimer,idleCheck,10
setTimer,tool,10
return
tool:
;tool(getTimeIdleNoMouse())
tooltip % getTimeIdleNoMouse(1)
return
idleCheck(){
hotkeylist:=["LButton","RButton","MButton","WheelUp","WheelDown","XButton1","XButton2"]
global _idleTick
if(!_idleTick){
_idleTick:=a_tickCount
for i,a in hotkeylist
hotkey,% "~*" . a,getTimeIdleNoMouse
}
input,c,L1VMI,{backspace}{LControl}{RControl}{LShift}{RShift}{Appskey}{Up}{Down}{Left}{Right}{Capslock}{Printscreen}{home}{end}{pgup}{pgdn}{LAlt}{RAlt}{ins}{del}{pause}{break}
_idleTick:=a_tickCount
}
getTimeIdleNoMouse(bool:=0){
global _idleTick
if(!bool)
_idleTick:=a_tickCount
else
return a_tickCount - _idleTick
}