The good news is: THIS CAN BE DONE!
And actually, is a nice idea.
I just made a small sketch on how to do it in ahk:
;IdleClose
WinGet, id, list,,,Program Manager
WindowList =
Loop, %id%
{
StringTrimRight, this_id, id%a_index%, 0
WinGetTitle, this_name, ahk_id %this_id%
if this_name !=
{
MsgBox, the name is: %this_name%`nand it has this id: %this_id%
;£ divides the srting for the several programs existing
;§ divides the string between {ahk_id} and {time_idle}
windowlist =%windowlist%£%this_id%§0
}
}
Loop, Parse, WindowList, £
{
Loop,Parse, A_LoopField,§
{
If A_Index = 1
Id =%A_LoopField%
else
MsgBox, Id: %Id%`nidle time: %A_LoopField%
}
}
return
The code above lists all windows that exist (and have name!!), and puts their ids to a list, folowed by another parameter, that will be used to put the time idle. After that, it runs through that list, and gets the ids and time idle again.
I launched this code, because i need to know if it finds the windows you'd like it to find. In my computer, it found every window i had open, please run it in yours and tell me if something is missing!
The problem is, that i don't think you'd like it to close every window, possibilly it should leave some windows open.
And i still don't know how to handle a small thing that was forgotten in this post: how about when you go away, and leave the pc? When you return, it'd have closed all the programs you have. Maybe the concept should be redefined.
I'll try to do this program today during the afternoon, I'll keep you posted