About FileGetTime
Posted: 04 Dec 2019, 01:06
Hello,
I have a question need your help. Program_A can search all files in the the folder(G:\Download\).
Due to search long time, I want to search for files in five months, so I added the code as below in program_B.
Then as you can see, it is incomplete. How can I to control this search in five months ?
I will appreciate your help with this situation.
Program_A:
Program_B:
I have a question need your help. Program_A can search all files in the the folder(G:\Download\).
Due to search long time, I want to search for files in five months, so I added the code as below in program_B.
Then as you can see, it is incomplete. How can I to control this search in five months ?
I will appreciate your help with this situation.
Code: Select all
FormatTime, TimeString,,yyyy/mm/dd ;<<<<<<<<<<<<<<<<<<<<<<<
FileGetTime, DateTime, G:\Download\Paper_A.txt, C ;<<<<<<<<<<<<
If DateTime < ??? ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Program_A:
Code: Select all
SetBatchLines, -1
LoadData_GroupA("G:\Download\")
LoadData_GroupA(Folder) {
objA := {}
Loop, Files, % Folder . "\Paper_A.txt*.log"
{
FileRead, data, %A_LoopFileFullPath%
r := "`s)\R\((?P<date>\d{2}/\d{2}/\d{2}:\d{2}.\d{2})[^\r\n]+\R+"
. "BTP (?P<num>\d+)"
. ".*?\R+ (?P<temp>[\d.+-]+)"
startPos := 1
while foundPos := RegExMatch(data, r, m_, startPos) {
m_date := RegExReplace(m_date, "^(.{5})/(..)(.*)$", "$2/$1/$3")
if (m_date > objA[m_num]["date"]) {
objA[m_num] := {date: m_date, temp: m_temp}
}
startPos := foundPos + StrLen(m_)
}
}
for n, ctrlId in {Level_1:"card1", Level_2:"card2", Level_3:"card3", Level_4:"card4"} {
GuiControl,, % ctrlId, % objA[n].temp
}
Code: Select all
SetBatchLines, -1
LoadData_GroupA("G:\Download\")
LoadData_GroupA(Folder) {
objA := {}
FormatTime, TimeString,,yyyy/mm/dd ;<<<<<<<<<<<<<<<<<<<<<<<
FileGetTime, DateTime, G:\Download\Paper_A.txt, C ;<<<<<<<<<<<<
If DateTime < ??? ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Loop, Files, % Folder . "\Paper_A.txt*.log"
{
FileRead, data, %A_LoopFileFullPath%
r := "`s)\R\((?P<date>\d{2}/\d{2}/\d{2}:\d{2}.\d{2})[^\r\n]+\R+"
. "BTP (?P<num>\d+)"
. ".*?\R+ (?P<temp>[\d.+-]+)"
startPos := 1
while foundPos := RegExMatch(data, r, m_, startPos) {
m_date := RegExReplace(m_date, "^(.{5})/(..)(.*)$", "$2/$1/$3")
if (m_date > objA[m_num]["date"]) {
objA[m_num] := {date: m_date, temp: m_temp}
}
startPos := foundPos + StrLen(m_)
}
}
for n, ctrlId in {Level_1:"card1", Level_2:"card2", Level_3:"card3", Level_4:"card4"} {
GuiControl,, % ctrlId, % objA[n].temp
}