Годится?
#SingleInstance, Force
#NoEnv
SetWorkingDir, A_ScriptDir
Global counter := 1
, storage := "16.txt"
, template := "Какой-то текст {} {}.{}.{}"
, storageContent
if !(FileExist(storage)) {
FileAppend,% Format(template, 0, A_DD, A_MM, A_YYYY),% storage, UTF-8
storageContent := ""
} else if (IsMatched()) {
oFile := FileOpen(storage, "r", "UTF-8")
oFile.Seek(-20)
content := oFile.Read()
oFile.Close()
RegExMatch(content, ".* ([\d]+) [\d\.]+", m)
counter := m1 + 1
}
i := 8
Loop 247
Hotkey, % "~vk" . Format("{:X}", i++), WatchPress, On
Return
WatchPress() {
oFile := FileOpen(storage, "w", "UTF-8")
str := Format(template, IsMatched() ? counter++ : counter++, A_DD, A_MM, A_YYYY)
oFile.Write(Format("{}{}{}",storageContent, storageContent ? "`n`n" : "", str))
oFile.Close()
}
IsMatched() {
FileGetTime, storageTime,% storage
FormatTime, storageYDay,% storageTime, YDay
FormatTime, storageYear,% storageTime, yyyy
if (storageYear == A_YYYY && storageYDay == A_YDay)
Return true
oFile := FileOpen(storage, "r", "UTF-8")
storageContent := oFile.Read()
oFile.Close()
counter := 1
Return false
}