Grovkillen,
I have also experienced this phenomenon for quite a while. Wrote my first KeyLogger in 2007 using the relatively new OnEvent> function. That particular script had a separate subroutine for each letter. I don't recall when I rewrote it using one subroutine and a fifth onevent parameter but it was not long after. I remediated the jump-to-top issue with a flag variable at the start of the script. If>BlahVar=1,Loop this jumped from the top of the script to my idle loop. That way we skipped over the onevents so they didn't get loaded over and over with each key press. Just put a Let>Blahvar=1 at the end of the onevent block. A bigger issue for me at that time was keeping the keystrokes limited. Touching a letter key quickly would produce ten or more copies of that letter. The idle loop can be used to control the repeats but timing is difficult. Too fast and you still get multiples, too slow and you miss the next letter from a fast typer.
In any case here is a much more reliable method. Still has its issues. I wrote this as a novelty years ago but did not post it for not wanting to post a keylogging script. Today I think keyloggers are the least of our security concerns. This uses the OnKeyPress dialog event. Then as a demo writes the key presses to a Macro Scheduler message box. The key presses need to be typed onto the dialog, so the script will create a monster, invisible, stayontop dialog. The script times out after 30 seconds but can be closed sooner by picking the "X" to close the message box.
If nothing else I hope this is a pleasant diversion for your always active mind.
Dick
Code: Select all
//Max workable setting = 23171
Let>vDim=23170
Let>onceFlag=1
Message>A message to be edited (sort of)
Wait>0.3
Dialog>Dialog1
object Dialog1: TForm
BorderStyle = bsNone
Caption = 'Custo-Changio'
AlphaBlend = True
AlphaBlendValue = 0
Position = poScreenCenter
FormStyle = fsStayOnTop
end
EndDialog>Dialog1
SetDialogProperty>Dialog1,,ClientHeight,vDim
SetDialogProperty>Dialog1,,ClientWidth,vDim
AddDialogHandler>Dialog1,,OnKeyPress,SUBROUTINE_NAME
Show>Dialog1
GetControlText>Macro Scheduler Message,TMemo,1,vPhrase
VbEval>timer,StartTime
Label>TimeLoop
Wait>0.01
MoveWindow>Custo-Changio,-2000,-2000
VbEval>timer-%StartTime%,TotalTime
If>TotalTime>30
CloseWindow>Macro Scheduler Message
EndIf
IfWindowOpen>Macro Scheduler Message
Else
Exit>0
EndIf
Goto>TimeLoop
SRT>SUBROUTINE_NAME
If>SUBROUTINE_NAME_Key=8
Length>vPhrase,vLen
If>vLen>0
Sub>vLen,1
Midstr>vPhrase,1,vLen,vPhrase
EndIf
Else
If>SUBROUTINE_NAME_Key=13
Let>vPhrase=%vPhrase%%crlf%
Else
VBEval>Chr(%SUBROUTINE_NAME_Key%),vKeyPressRes
Let>vPhrase=%vPhrase%%vKeyPressRes%
EndIf
EndIf
SetControlText>Macro Scheduler Message,TMemo,1,%vPhrase% - %SUBROUTINE_NAME_Key%
END>SUBROUTINE_NAME