;
; ArchiveInput: 0.1 by justice
;
; Script Function:
; Copy control's content to textfile. Press scrolllock to start / stop recording to the textfile archiveinput.log
;
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
DetectHiddenWindows, on
SetWorkingDir, %A_ScriptDir%
logfile = %A_ScriptDir%\archiveinput.log
traytiptitle = ArchiveInput
togg = n ; on/off toggle
Hotkey, ScrollLock, Toggle
return
Toggle:
if togg = n
{
Gosub, Start
togg = y
} else
{
GoSub, Stop
togg = n
}
return
Start:
FileDelete, %logfile%
SetTimer, ArchiveInput, 5000
traytip, %traytiptitle%, Started saving input every 5 seconds...
return
Stop:
SetTimer, ArchiveInput, Off
traytip, %traytiptitle%, Disabled
return
ArchiveInput:
FormatTime , GmtTime,%A_NowUTC%,ddd`, dd MMM yyyy HH:mm:ss GMT
WinGet, active_id, ID, A
if ErrorLevel
traytip, %traytiptitle%, Can't find active window
ControlGetFocus, activeControl,ahk_id %active_id%
if ErrorLevel
traytip, %traytiptitle%, The target window doesn't exist or none of its controls has input focus.
else
ControlGetText, activeText, %activeControl%, ahk_id %active_id%
If %activeText%
traytip, %traytiptitle%, Saved text: %GmtTime%`n %activeText%
else
{
ControlGet, activeText , List,, %activeControl%, ahk_id %active_id%
If %activeText%
traytip, %traytiptitle%, Saved text: %GmtTime%`n %activeText%
else
traytip, %traytiptitle%, no input (unsupported control)
`n %activeControl% / ahk_id %active_id% `n
}
FileAppend, %GmtTime%:`n, %logfile%
FileAppend, %activeText%, %logfile%
FileAppend, `n`n`n`n, %logfile%
activeText =
GmtTime =
return