Welcome Guest.   Make a donation to an author on the site July 29, 2014, 07:49:59 AM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
Free DonationCoder.com Member Kit: Submit Request.
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: [1]   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: DONE: IdleClose - exit certain programs after x minutes of idle time  (Read 10340 times)
brotherS
Master of Good Ideas
Honorary Member
**
Posts: 2,105


To make a difference, be different.

View Profile Give some DonationCredits to this forum member
« on: February 09, 2006, 03:08:06 AM »

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:58 AM by brotherS » Logged

Thank you.
Gerome
Charter Honorary Member
***
Posts: 154


View Profile WWW Give some DonationCredits to this forum member
« Reply #1 on: February 09, 2006, 04:20:41 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 smiley
Logged

Yours,
(¬Į`¬∑._.FBSL Help file]
(¬Į`¬∑._.¬
allen
Charter Member
***
Posts: 1,166



Powered by Beard

see users location on a map View Profile Read user's biography. Give some DonationCredits to this forum member
« Reply #2 on: February 09, 2006, 07:01:58 AM »

. . . and if it could automatically click "save" when the program pops up asking if you'd like to, it'd be even smarter cheesy
Logged
brotherS
Master of Good Ideas
Honorary Member
**
Posts: 2,105


To make a difference, be different.

View Profile Give some DonationCredits to this forum member
« Reply #3 on: February 09, 2006, 07:09:54 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 smiley
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 cheesy
Hehe... I would use it only for programs that don't need to save anything. smiley
Logged

Thank you.
jgpaiva
Global Moderator
*****
Posts: 4,710



Artificial Idiocy

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #4 on: February 09, 2006, 07:13:52 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:
[copy or print]
;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 Wink
Logged

Cpilot
Charter Honorary Member
***
Posts: 293



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #5 on: February 09, 2006, 07:17:46 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.
Logged
brotherS
Master of Good Ideas
Honorary Member
**
Posts: 2,105


To make a difference, be different.

View Profile Give some DonationCredits to this forum member
« Reply #6 on: February 09, 2006, 07:18:39 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.
cheesy cheesy

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 smiley
« Last Edit: February 09, 2006, 07:24:13 AM by brotherS » Logged

Thank you.
jgpaiva
Global Moderator
*****
Posts: 4,710



Artificial Idiocy

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #7 on: February 09, 2006, 07:26:19 AM »

Ooops brotherS.. I understood you completely wrong.
That's easier to do, i think Wink
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?
Logged

jgpaiva
Global Moderator
*****
Posts: 4,710



Artificial Idiocy

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #8 on: February 09, 2006, 07:34:54 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 Wink

[copy or print]
-> 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
Logged

brotherS
Master of Good Ideas
Honorary Member
**
Posts: 2,105


To make a difference, be different.

View Profile Give some DonationCredits to this forum member
« Reply #9 on: February 09, 2006, 09:15:50 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 http://www.donationcoder....um/index.php?topic=1801.0) since they normally just show their tray icon, so there's no window that could be checked for activity...
Logged

Thank you.
Gerome
Charter Honorary Member
***
Posts: 154


View Profile WWW Give some DonationCredits to this forum member
« Reply #10 on: February 09, 2006, 09:19:12 AM »

Hehe smiley

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 http://www.donationcoder....um/index.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 smiley
« Last Edit: February 09, 2006, 09:20:49 AM by Gerome » Logged

Yours,
(¬Į`¬∑._.FBSL Help file]
(¬Į`¬∑._.¬
jgpaiva
Global Moderator
*****
Posts: 4,710



Artificial Idiocy

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #11 on: February 09, 2006, 09:31:13 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 Wink )
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 smiley
If nobody presents a better solution to do this, I will do it. Otherwise, i will only use it Wink
Logged

skrommel
Fastest code in the west
Developer
***
Posts: 882



View Profile WWW Give some DonationCredits to this forum member
« Reply #12 on: February 09, 2006, 11:28:31 AM »

 smiley My ProcessGuard at http://www.donationcoder.com/Software/Skrommel/index.html#ProcessGuard should be able to do this.

Skrommel
Logged

Please stop by my site at  1 Hour Software by skrommel  for downloads and more info.
brotherS
Master of Good Ideas
Honorary Member
**
Posts: 2,105


To make a difference, be different.

View Profile Give some DonationCredits to this forum member
« Reply #13 on: February 09, 2006, 12:19:47 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.

Sad
Logged

Thank you.
brotherS
Master of Good Ideas
Honorary Member
**
Posts: 2,105


To make a difference, be different.

View Profile Give some DonationCredits to this forum member
« Reply #14 on: February 15, 2006, 05:16:41 AM »

Found a simple solution for my idea:

[copy or print]
;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. smiley
Logged

Thank you.
tmpusr
Member
**
Posts: 154


Instantiation stuck in meatspace with no backup

View Profile Give some DonationCredits to this forum member
« Reply #15 on: March 24, 2010, 12:22:30 AM »

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 http://www.donationcoder....16018.msg199584#msg199584
Is that against the rules?
« Last Edit: March 24, 2010, 04:32:06 PM by tmpusr » Logged
Pages: [1]   Go Up
  Reply  |  New Topic  |  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 0.048s | Server load: 0.18 ]