Today we found out that two new shelters are opening nearby and they would like to use the scripts we have as well. But we want to seperate the statistics. Here is how the architechture looks like:
Menu -that shows 20 scripts
Each script there's a Write statisticsfunction after "submit".
The function for the statistics are inside a file called functions.ahk that's #included in each script.
-------------
Here's my thought, maybe there's better and that I would like to know:
The menu get's installed by a simple "installation" ahk which basically puts the menu in a users autostart. The idea now is that when they press it, a gui popup where they can select their city.
Then it get's installed and a Cityname.ini (or .txt) file will be created and stored locally.
My thought is that the statistic code will read the filename and insert it into the path So i.e: Scriptrun_user_date_CITYNAME_count.txt.
Is there a better way? Here is my current stats code:
Code: Select all
WriteStatistic()
{
FormatTime, DDay, %Dday%, yyyyMM
NetworkFolder := "Z:\AutoHotkey\Scripts\statistics"
ThisScript := RegExReplace(A_ScriptName, "iDU)^(.*)\.(ahk|exe)$", "$1")
if fileexist(NetworkFolder "\" ThisScript "_" A_UserName "_" Dday "*") {
loop, % NetworkFolder "\" ThisScript "_" A_UserName "_" Dday "*" {
RegExMatch(A_LoopFileName, "O)(.*)_(\d+)\.txt",tmp)
newName := NetworkFolder "\" tmp[1] "_" format("{:04}",tmp[2] + 1) ".txt"
FileMove, % NetworkFolder "\" A_LoopFileName , % newName
FileAppend, % a_now "`n", % newName
}
} else {
FileAppend, % a_now "`n", % NetworkFolder "\" ThisScript "_" A_UserName "_" dday "_" format("{:04}",1) ".txt"
}
return
}