Jump to content

Seeking complete definition of "idle" as used by _Timer_GetIdleTime function


timmy2
 Share

Recommended Posts

Every script, post and Help file entry that I have read defines "idle" as no mouse or keyboard activity. 

Quote

_Timer_GetIdleTime
Returns the number of ticks since last user activity (i.e. KYBD/Mouse)

"i.e" means "for example", which a lawyer would say means "includes but is not limited to".  Leaving that thought dangling...

 This article, "The Definition of Windows Idle," says:

Quote
The computer is considered to be idle by Windows if there has not been user interaction via the mouse or keyboard for a given time and if the hard drives and processors have been idle more than 90% of that time. (Windows 7 considers the PC to be idle if these states return true for a period of 10 minutes.)

How do you reconcile the two?  If we're referring to the same measurement of "idle" it would mean that Task Scheduler's "on idle" will trigger after 600,000 ticks as measured by _Timer_GetIdleTime, correct?

Edited by timmy2
clarification
Link to comment
Share on other sites

  • Moderators

You posted this in GH & S, do you have a script-specific question, or is this more of a philosophical question destined for the appropriate sub forum?

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

AutoIt uses the GetLastInputInfo function to determine idle time in that function. It's got nothing to do with  how Windows determines idle time, so that link doesn't apply here.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

15 hours ago, BrewManNH said:

AutoIt uses the GetLastInputInfo function to determine idle time in that function. It's got nothing to do with  how Windows determines idle time, so that link doesn't apply here.

Thank you for answering, @BrewManNH! So it sounds like "idle" here really means "user idle". Can AutoIt access Windows' idle function, thereby taking into account hardware activity, too?

Link to comment
Share on other sites

On 11/30/2018 at 9:06 AM, timmy2 said:

Can AutoIt access Windows' idle function, thereby taking into account hardware activity, too?

Yes, but why would you want to? Most of the documentation I've read for idle time is for the task scheduler, so if you're not using it as a scheduled task, user interaction would be the best indication of "idleness".

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

4 hours ago, BrewManNH said:

Yes, but why would you want to? Most of the documentation I've read for idle time is for the task scheduler, so if you're not using it as a scheduled task, user interaction would be the best indication of "idleness".

Sometimes I overlook the obvious, so I might be doing that here, but what if the user is watching a YouTube video?

Come to think of it, I suppose I could deal with situations like that by displaying a prompt with a timeout. If the user doesn't respond I can proceed with my housekeeping and logging out the session.

Hmm, but what if the user is rendering something in a CGI program or some other CPU-/HDD-intensive process, and the user isn't present? I think that's what prompted me to ask about the AutoIt definition of "idle". I don't recall at the moment why I didn't want to just use Task Scheduler, and maybe have it spawn an AutoIt script.

Nonetheless, isn't it worth noting the different "idle" meanings?

Link to comment
Share on other sites

You're looking for something along the lines of, for example, disabling the screensaver. Which means telling the OS that the computer is being used, even if no one is interacting with it. For that you'd probably need to set the ThreadExecutionState with the ES_DISPLAY_REQUIRED/ES_CONTINUOUS parameter setting. I believe there was a recent thread on this here.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

25 minutes ago, BrewManNH said:

You're looking for something along the lines of, for example, disabling the screensaver. Which means telling the OS that the computer is being used, even if no one is interacting with it. For that you'd probably need to set the ThreadExecutionState with the ES_DISPLAY_REQUIRED/ES_CONTINUOUS parameter setting. I believe there was a recent thread on this here.

I apologize for being unclear, but thank you for replying, @BrewManNH. I want to run an AutoIt script that will do some housekeeping and then log out the user. But I don't want to do that -- especially logging him out -- if he's still "using" the computer. Microsoft's version of "idle" is more complete since it takes into account user activity as well as CPU and HDD activity.  I was wondering if AutoIt was tapping into the same Idle, but it turns out it's using a different source that solely user activity.

Link to comment
Share on other sites

It's probably not what you are looking since a lot of people I find do not like using Task Scheduler but, if you want to run a cleanup and log off the user when Windows goes "idle", you can make an AutoIT script that Task Scheduler starts when the computer goes "idle". 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...