topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday March 28, 2024, 7:43 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: DONE: IdleClose - exit certain programs after x minutes of idle time  (Read 44143 times)

brotherS

  • Master of Good Ideas
  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 2,260
    • View Profile
    • Donate to Member
Hi,

I'd love a little tool to automatically close certain programs after I haven't used them for x minutes. I'm not sure if that's an easy task or not, but I could really use such a tool to auto-close some programs!

It would be perfect if I could specify the number of minutes for each program/exe after which IdleClose should kick in.
« Last Edit: February 15, 2006, 05:16 AM by brotherS »

Gerome

  • Charter Honorary Member
  • Joined in 2006
  • ***
  • Posts: 154
    • View Profile
    • Get my Freestyle Basic Script Language + compiler!
    • Donate to Member
Re: IDEA: IdleClose - exit certain programs after x minutes of idle time
« Reply #1 on: February 09, 2006, 04:20 AM »
Hi,

If you gimme the name of the API that allows to retrieve the Status of a running program, i can make a sample to demonstrate easily how to do this job :)
Yours,
(¯`·._.·[Gerome GUILLEMIN]·._.·´¯)
http://www.fbsl.net [FBSL Author]
http://gedd123.free.fr/FBSLv3.zip [FBSL Help file]
(¯`·._.·[If you need help... just ask]·._.·´¯)

allen

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 1,206
    • View Profile
    • Donate to Member
Re: IDEA: IdleClose - exit certain programs after x minutes of idle time
« Reply #2 on: February 09, 2006, 07:01 AM »
. . . and if it could automatically click "save" when the program pops up asking if you'd like to, it'd be even smarter :D

brotherS

  • Master of Good Ideas
  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 2,260
    • View Profile
    • Donate to Member
Re: IDEA: IdleClose - exit certain programs after x minutes of idle time
« Reply #3 on: February 09, 2006, 07:09 AM »
Hi,

If you gimme the name of the API that allows to retrieve the Status of a running program, i can make a sample to demonstrate easily how to do this job :)
Err... sorry, no idea...

. . . and if it could automatically click "save" when the program pops up asking if you'd like to, it'd be even smarter :D
Hehe... I would use it only for programs that don't need to save anything. :)

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: IDEA: IdleClose - exit certain programs after x minutes of idle time
« Reply #4 on: February 09, 2006, 07:13 AM »
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 ;)

Cpilot

  • Charter Honorary Member
  • Joined in 2006
  • ***
  • Posts: 293
    • View Profile
    • Bite Notes
    • Read more about this member.
    • Donate to Member
Re: IDEA: IdleClose - exit certain programs after x minutes of idle time
« Reply #5 on: February 09, 2006, 07:17 AM »
I would think you could enumerate all the open windows then flag the foreground window with GetForegroundWindow,then set all the others on a timer list to close at interval? The one with focus would be exempt from the timer.

brotherS

  • Master of Good Ideas
  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 2,260
    • View Profile
    • Donate to Member
Re: IDEA: IdleClose - exit certain programs after x minutes of idle time
« Reply #6 on: February 09, 2006, 07:18 AM »
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.
:D :D

I'd prefer if it would be based on active .exe processes, since I run some apps in tray icon mode only. And it really *should* close them whether I don't use them or leave the PC for an hour. That's where the different idle time for each .exe comes into play. Remember, I do not want to close ALL running programs, just a chosen few (but without having to select them again and again each day).

I won't mind just having to edit a script by myself to add those to a list, of course you could create a GUI too if you like that :)
« Last Edit: February 09, 2006, 07:24 AM by brotherS »

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: IDEA: IdleClose - exit certain programs after x minutes of idle time
« Reply #7 on: February 09, 2006, 07:26 AM »
Ooops brotherS.. I understood you completely wrong.
That's easier to do, i think ;)
So, the idea here is to have a script that contains a list of processes to be closed, and close them if that processes' windows have not been used for a specifiably amount of time, right?

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: IDEA: IdleClose - exit certain programs after x minutes of idle time
« Reply #8 on: February 09, 2006, 07:34 AM »
I made this small sketch of the script's core, please check if it's what you want, if it is, say something, and i'll convert this to a program ;)

-> Load Process List
-> wait for each of the processes
-> for each processes, launch a timer
-> last window active set to null
GoTo Loop


loop:
if window active is last window active
  sleep 200
  GoTo Loop
if last window active's process is in the list
  activate process's timer
if window active's process is in the list,
  stop window active's process's timer
last window active set to name of window active
GoTo Loop

brotherS

  • Master of Good Ideas
  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 2,260
    • View Profile
    • Donate to Member
Re: IDEA: IdleClose - exit certain programs after x minutes of idle time
« Reply #9 on: February 09, 2006, 09:15 AM »
Yes, now you got what I was trying to say  :Thmbsup:

But I doubt this will work for apps like FDM (Free Download Manager, read about it on https://www.donation...dex.php?topic=1801.0) since they normally just show their tray icon, so there's no window that could be checked for activity...

Gerome

  • Charter Honorary Member
  • Joined in 2006
  • ***
  • Posts: 154
    • View Profile
    • Get my Freestyle Basic Script Language + compiler!
    • Donate to Member
Re: IDEA: IdleClose - exit certain programs after x minutes of idle time
« Reply #10 on: February 09, 2006, 09:19 AM »
Hehe :)

Yes, now you got what I was trying to say  :Thmbsup:

But I doubt this will work for apps like FDM (Free Download Manager, read about it on https://www.donation...dex.php?topic=1801.0) since they normally just show their tray icon, so there's no window that could be checked for activity...
:

I bet you should try with the appropriated SendMessage, or with a language that well knows how to handle with a pico precision how to speak correctly with those kinda stuff :)
Yours,
(¯`·._.·[Gerome GUILLEMIN]·._.·´¯)
http://www.fbsl.net [FBSL Author]
http://gedd123.free.fr/FBSLv3.zip [FBSL Help file]
(¯`·._.·[If you need help... just ask]·._.·´¯)
« Last Edit: February 09, 2006, 09:20 AM by Gerome »

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: IDEA: IdleClose - exit certain programs after x minutes of idle time
« Reply #11 on: February 09, 2006, 09:31 AM »
Gerome: If you can do this in Fbsl, please do, as i think I can't do that program in ahk (i mean, i started using ahk 2 weeks ago, i'm no expert ;) )
brotherS: I also don't think that can work with those windows, using ahk, but maybe skrommel does. What i can do, is do the sketch i presented before, that is within my knowledge reach :)
If nobody presents a better solution to do this, I will do it. Otherwise, i will only use it ;)

skrommel

  • Fastest code in the west
  • Developer
  • Joined in 2005
  • ***
  • Posts: 933
    • View Profile
    • 1 Hour Software by skrommel
    • Donate to Member
Re: IDEA: IdleClose - exit certain programs after x minutes of idle time
« Reply #12 on: February 09, 2006, 11:28 AM »
 :) My ProcessGuard at https://www.donationcoder.com/Software/Skrommel/index.html#ProcessGuard should be able to do this.

Skrommel

brotherS

  • Master of Good Ideas
  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 2,260
    • View Profile
    • Donate to Member
Re: IDEA: IdleClose - exit certain programs after x minutes of idle time
« Reply #13 on: February 09, 2006, 12:19 PM »
Hi skrommel!

I tried that one last year but didn't like the fact that I always saw the Task Manager icon in the tray, also it was quite complicated to use and (probably because I missed something) I didn't get it to work correctly... But the Task Manager icon in the tray was my main reason not to use it, I really can't stand having something there that's changing all of the time.

:(

brotherS

  • Master of Good Ideas
  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 2,260
    • View Profile
    • Donate to Member
Re: IDEA: IdleClose - exit certain programs after x minutes of idle time
« Reply #14 on: February 15, 2006, 05:16 AM »
Found a simple solution for my idea:

;2006-02-15
;kill certain programs after x hours of idle time
#Persistent
AutoExec8:
SetTimer, AutoKill, 25000
;
; 3600000 milliseconds = 1 hour
; 5400000 milliseconds = 1,5 hours
; 7200000 milliseconds = 2 hours
; 7200000 milliseconds = 2 hours
; 9000000 milliseconds = 2,5 hours
;
AutoKill:
;    TrayTip, test, test
If A_TimeIdlePhysical > 5400000
 process, close, fdm.exe
If A_TimeIdlePhysical > 9000000
 process, close, winamp.exe
return

Sure, it won't watch the process itself, but I figured that's simple enough and comes close to what I wanted. :)

tmpusr

  • Member
  • Joined in 2005
  • **
  • Posts: 154
  • Instantiation stuck in meatspace with no backup
    • View Profile
    • Donate to Member
I need to automatically close only certain kinds of windows like Explorer and Everything (search) after they've been inactive for n seconds. I don't need help with closing any other tasks.
Option: Learn to exclude windows with a title that has stayed open for n seconds more than n times, i.e., stop auto-closing popular windows.

Also posted to JustCloseSomeTasks https://www.donation....msg199584#msg199584
Is that against the rules?
« Last Edit: March 24, 2010, 04:32 PM by tmpusr »

burntpepsi

  • Participant
  • Joined in 2014
  • *
  • default avatar
  • Posts: 2
    • View Profile
    • Donate to Member
Re: DONE: IdleClose - exit certain programs after x minutes of idle time
« Reply #16 on: August 14, 2014, 05:31 PM »
Is Idle Close a finished download? I've tried the JustCloseSomeTasks and ProcessGuard but those don't do what brotherS outlined above in his code. I don't know what that is written in or I'd just use that. Sorry for bumping an old post, I'm new to the forum today.

tomos

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 11,959
    • View Profile
    • Donate to Member
Re: DONE: IdleClose - exit certain programs after x minutes of idle time
« Reply #17 on: August 15, 2014, 08:18 AM »
Is Idle Close a finished download? I've tried the JustCloseSomeTasks and ProcessGuard but those don't do what brotherS outlined above in his code. I don't know what that is written in or I'd just use that. Sorry for bumping an old post, I'm new to the forum today.

hi burntpepsi :)
looks to me that post #14 was the nearest to a solution - save the script in that post with an .ahk file-ending.
Download AHK - it's portable, so you can put it anywhere.
http://ahkscript.org
Open the saved script with AHK - it will show in the tray.

disclaimer: I havent tried the script, so not even sure what exactly it does...
Tom

burntpepsi

  • Participant
  • Joined in 2014
  • *
  • default avatar
  • Posts: 2
    • View Profile
    • Donate to Member
Re: DONE: IdleClose - exit certain programs after x minutes of idle time
« Reply #18 on: August 15, 2014, 09:21 AM »
Fantastic! Thank you tomos for such a friendly and accurate response. The script works great. I'm going to love this site.

tomos

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 11,959
    • View Profile
    • Donate to Member
Re: DONE: IdleClose - exit certain programs after x minutes of idle time
« Reply #19 on: August 15, 2014, 10:19 AM »
Fantastic! Thank you tomos for such a friendly and accurate response. The script works great. I'm going to love this site.

great :-)
Tom

karmaschizo

  • Participant
  • Joined in 2015
  • *
  • default avatar
  • Posts: 1
    • View Profile
    • Donate to Member
Thank you so much. I found this script and it's great to force close idling programs.  Can someone tweak it to monitor non-cpu usage?  that is, if cpu usage is zero for a set interval, to close.  for example, if a program (like a movie player) is running it isn't idling. any help would most grateful. thanks for the ahk script though, I love it.