Sign in to follow this  
Followers 0
gertsolo

Windows AutoIt to Standby

8 posts in this topic

#1 ·  Posted (edited)

Hey,

I have a remote PC which I use as server for my media files. When I don't use it I want it to go to standby after, for example, one hour. When I want to use it I wake it up on Lan.

When I use the default windows power settings it works fine from time to time, but not always. Is there a better AutotIt alternative for monitoring a windows system and letting it go to standby when there is no activity?

thx

Edited by gertsolo

The more you learn, the less you know.

Share this post


Link to post
Share on other sites



It depends on how well you define "idle". If you are only looking at no mouse and no keyboard use, that's easy enough. This CodeProject article has code for a dll that will let you check the ticks (a unit of time) that the user has not moved the mouse or touched the keyboard.

Share this post


Link to post
Share on other sites

It depends on how well you define "idle". If you are only looking at no mouse and no keyboard use, that's easy enough. This CodeProject article has code for a dll that will let you check the ticks (a unit of time) that the user has not moved the mouse or touched the keyboard.

Hi,

have a look at the _Net* functions.

You may loop and check if files are open. In the loop you have a sleep (60000)

If no Files are open count up an counter and shutdown server if counter = 60

If files are open reset counter.

;-))

Stefan

Share this post


Link to post
Share on other sites

Looking at the files won't be very good because Windows will hold some files of it's own.

Share this post


Link to post
Share on other sites

It depends on how well you define "idle". If you are only looking at no mouse and no keyboard use, that's easy enough. This CodeProject article has code for a dll that will let you check the ticks (a unit of time) that the user has not moved the mouse or touched the keyboard.

I use is as remote server, so there is no mouse/keyboard activity. I want it to go to sleep when no other computers or media servers are connecting to it.


The more you learn, the less you know.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Then you might want to look at the command "net session" in Windows. I don't know for sure how it works, but I believe it will tell you (via the console) about any connections to the computer.

net session

Is literally what you would type into the prompt. I don't know if that was clear enough.

Edited by Richard Robertson

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Then you might want to look at the command "net session" in Windows. I don't know for sure how it works, but I believe it will tell you (via the console) about any connections to the computer.

net session

Is literally what you would type into the prompt. I don't know if that was clear enough.

Yup, it is clear enough. I already told me that there are no active connections, so there is something else that keeps it awake.

thx

Edited by gertsolo

The more you learn, the less you know.

Share this post


Link to post
Share on other sites

You could make an AutoIt script that reads the output from net session every once in a while (every 5 minutes maybe) and if it says no sessions, then call Shutdown(32). That's standby.

Would that work?

Share this post


Link to post
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
Sign in to follow this  
Followers 0