Close a specific folder after inactivity?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
wastingpenguins
Posts: 15
Joined: 04 Feb 2018, 21:54

Close a specific folder after inactivity?

30 Apr 2024, 13:48

I want Windows to automatically close a specific folder in File Explorer, either after only that folder experiences inactivity (preferred), or after a period of inactivity with the PC as a whole. I guess probably the folder would be closed based on its specific title. As a last resort, it would be okay if all File Explorer folders were closed after a period of inactivity.

Is this possible?

To explain: I want to make sure work folders are closed when not in use so that my kid doesn't accidentally (or intentionally) mess with them when he uses my PC.
User avatar
mikeyww
Posts: 28989
Joined: 09 Sep 2014, 18:38

Re: Close a specific folder after inactivity?

30 Apr 2024, 16:47

Hello,

You could set a timer to check :arrow: A_TimeIdlePhysical. When it exceeds a certain value, you can WinClose.
wastingpenguins
Posts: 15
Joined: 04 Feb 2018, 21:54

Re: Close a specific folder after inactivity?

03 May 2024, 13:51

mikeyww wrote:
30 Apr 2024, 16:47
Hello,

You could set a timer to check :arrow: A_TimeIdlePhysical. When it exceeds a certain value, you can WinClose.

Thank you, I'm having trouble getting it to work. Would anyone be able to help me with this script?

For example, close a folder called "Work" if inactive for 5 minutes.

Thank you.
User avatar
mikeyww
Posts: 28989
Joined: 09 Sep 2014, 18:38

Re: Close a specific folder after inactivity?

03 May 2024, 14:06

Code: Select all

#Requires AutoHotkey v1.1.33.11

dir           := "utils" ; Window title of File Explorer
closeAfterMin := 5

#Persistent
#InstallKeybdHook
#InstallMouseHook
Process Priority,, B
closeAfterMS  := 60000 * closeAfterMin
winTitle      := dir " ahk_class CabinetWClass"
SetTimer Check, 5000
Check:
ToolTip % A_TimeIdlePhysical
If WinExist(winTitle) && A_TimeIdlePhysical > closeAfterMS {
 WinClose
 SoundBeep 1500
}
Return

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Daimonicon, Google [Bot], vsub and 101 guests