I have a functioning AHK script
I want a message box to show how many times that script has been opened in a month
Eg. when the script runs , a message box should display something as follows :
"Jul
6"
Now I know that the script has run 6 times in the month of July
once August begins, the counting should reset and start from 1 as opposed to continuing from the previous month's count
I found the following code , but how to include month specific counting ?
Code: Select all
; v1
scriptCount(){
static count := 0
static wasIncremented := scriptCount() ; sets the script count
local scriptCode, oldCount
if !wasIncremented {
fileRead scriptCode, % A_ScriptFullPath
if !scriptCode
return
if !regexmatch(scriptCode, "O)\QscriptCount(){\E\s+static count := (\d+)", oldCount)
return
if !scriptCode:=regexreplace(scriptCode, oldCount[1], oldCount[1]+1, , 1, oldCount.pos(1))
return
fileDelete % A_ScriptFullPath
fileAppend % scriptCode, % A_ScriptFullPath
count++
return true
}
return count
}
msgbox % "script run number: " scriptCount() ; gets the script count
I would be very grateful if anyone can kindly assist me
Regards