If modified time is over 10 minutes, then close window

Get help with using AutoHotkey and its commands and hotkeys
User avatar
europa
Posts: 15
Joined: 14 Aug 2019, 04:41
Contact:

If modified time is over 10 minutes, then close window

05 Nov 2019, 08:18

Hi,

I have a code that gets the modified time of a file.

What I want is to check in a loop that goes forever: If the modified time is over 10 minutes, then close the program.

My question is:
- How to make a if statement that runs forever?
- How to get current datetime to check against.

My code:

Code: Select all

FileGetTime, modifiedTime, %caseFilesDirectoryAddress%\%caseNumber%\IEF\%caseNumberYearJournalDistrictNumericTitleClean%\IEFv6.db  ; Retrieves the modification time by default.
if(modifiedTime < ???){
    WinWait, Internet Evidence Finder
    WinClose Internet Evidence Finder
}
Mod check.png
Mod check.png (70.26 KiB) Viewed 148 times
https://imgur.com/a/meWvW6h
Kobaltauge
Posts: 225
Joined: 09 Mar 2019, 01:52
GitHub: MassimoCastell
Location: Germany
Contact:

Re: If modified time is over 10 minutes, then close window

05 Nov 2019, 15:01

This loops breaks if time differ 10 min 00 sec.

Code: Select all

Loop
{
	FileGetTime, modifiedTime, %caseFilesDirectoryAddress%\%caseNumber%\IEF\%caseNumberYearJournalDistrictNumericTitleClean%\IEFv6.db  ; Retrieves the modification time by default.
	difftime := A_Now - modifiedTime
	if (difftime > 1000)
	{	
		MsgBox % "more than 10 min"
		Break
	}
}

Return to “Ask For Help”

Who is online

Users browsing this forum: A-W-D-space, Frosti, Google [Bot], Rohwedder, Xeo786 and 157 guests