This is heading in the right direction. Still need to calculate the total, and create an ini instead of deleting a file. At home this will work perfectly, but at work I have multiple computers which complicates things.
Because I've been learning regex I think it is the solution to everything problem I see. Though it does work nicely here I think. But I wonder WWLD?
var1 = ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
Code:
FileDelete, %A_ScriptDir%\keycount.log
FileAppend, %var1%, %A_ScriptDir%\keycount.log
SetTimer, s_Reset, 900000 ; every fifteen minutes
Loop
{
Input Key, L1 V, {ScrollLock}{CapsLock}{NumLock}{TAB}{Esc}{BS}{Enter}{PrintScreen}{Pause}{LControl}{RControl}{LAlt}{RAlt}{LShift}{RShift}{LWin}{RWin}{F1}{F2}{F3}{F4}{F5}{F6}{F7}{F8}{F9}{F10}{F11}{F12}{Left}{Right}{Up}{Down}{Home}{End}{PgUp}{PgDn}{Del}{Ins}
if ErrorLevel contains EndKey
{
if (ErrorLevel <> v_PriorEndKey)
{
v_Count++
}
v_PriorEndKey = %ErrorLevel%
}
if ErrorLevel contains Max
{
v_Count++
}
}
return
~*LButton::
~*RButton::
~*MButton::
v_Count++
return
s_Reset:
FileRead, v_File, %A_ScriptDir%\keycount.log
v_Results := RegexReplace(v_File, "^.*?,", "")
FileDelete, %A_ScriptDir%\keycount.log
FileAppend, %v_Results%`,%v_Count%, %A_ScriptDir%\keycount.log
v_Count =
v_Results =
return