NextPVR Forums

Full Version: Can I disable "Delayed Standby" after is has been requested?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5
keith_leitch Wrote:Is this a file you posted for me? I can't find the one you mean.

attached to the post i've linked to are 2 zips. in the server one you'll find the au3 skript. another alternative: http://forums.nextpvr.com/showthread.php?t=25751 has the original script i modified for my needs on the first post
Mister Slimm Wrote:Entry points (the IsSystemResumeAutomatic bit) are case sensitive. You have to type exactly as I have. This code runs without error:
Code:
rundll32 Kernel32.dll, IsSystemResumeAutomatic
If it sets the return code then I believe the following should perform the echo when the system resume is unattended:
Code:
IF ERRORLEVEL 1 THEN ECHO "Spooky, there's no-one here."
However, as you point out, it is a boolean function and the return code is likely to always be zero. I've written a teensy console app (it still requires .NET 2.0) that sets the return code to the result of this function and so the ERRORLEVEL check should perform correctly. I've tested that it sets the return code but haven't tested whether it does what is expected on an unattended resume. Also note that all power management functions in Windows are notoriously inconsistent and only require the tiniest thing to be different (like tying your shoelaces the opposite way to normal or only giving the cat 3mm of water in their dish) to produce unexpected results. Still, if it helps that'll be great.

Hi, Slimm. After all the trouble you've gone to, I'm sorry it took so long to test this. I have now run a few tests, and as far as I can tell the app never produces errorlevel 1. I created a batch file that simply runs it and reports the errorlevel, and also set that batch file to wake up the computer as a scheduled task: always errorlevel 0.
keith_leitch Wrote:Hi, Slimm. After all the trouble you've gone to, I'm sorry it took so long to test this. I have now run a few tests, and as far as I can tell the app never produces errorlevel 1. I created a batch file that simply runs it and reports the errorlevel, and also set that batch file to wake up the computer as a scheduled task: always errorlevel 0.

Odd, but not entirely unexpected; shame.
Mister Slimm Wrote:Odd, but not entirely unexpected; shame.

My apologies! I must not have had .NET installed on my laptop. I thought that I did.

With .NET installed, the tiny app works as described (though unreliably, as you predicted). I will use it to determine whether my PC came out of "sleep" automatically, but will also do a secondary check of whether there are 2 minutes or less left before a scheduled recording, and whether it is time for an EPG update.

Thanks for your programming services!
Mister Slimm Wrote:This code runs without error:
Code:
rundll32 Kernel32.dll, IsSystemResumeAutomatic
If it sets the return code then I believe the following should perform the echo when the system resume is unattended:
Code:
IF ERRORLEVEL 1 THEN ECHO "Spooky, there's no-one here."

Having tested Slimm's tiny app (attached to the original post) for some time now, I am finding that it is actually quite reliable (provided .NET is installed). In all these weeks it has only twice detected a "false manual" resume, and never detected a "false automatic" resume. I recommend this to anyone who wishes to detect, from a batch file, whether their system came on by itself. Thanks again, Slimm!
Just discovered that this tells you what woke the computer up.
Code:
powercfg -lastwake
Mister Slimm Wrote:Just discovered that this tells you what woke the computer up.
Code:
powercfg -lastwake

Hmm...not available on my copy of XP. From the help file:

Examples:
POWERCFG /LIST
POWERCFG /QUERY scheme
POWERCFG /QUERY
POWERCFG /CREATE scheme
POWERCFG /DELETE scheme
POWERCFG /SETACTIVE scheme
POWERCFG /CHANGE scheme /monitor-timeout-dc 15
POWERCFG /CHANGE scheme /monitor-timeout-dc 0
POWERCFG /HIBERNATE on
POWERCFG /EXPORT scheme /file file
POWERCFG /QUERY number /NUMERICAL
POWERCFG /GLOBALPOWERFLAG on /OPTION BATTERYICON
POWERCFG /AVAILABLESLEEPSTATES
POWERCFG /BATTERYALARM low
POWERCFG /BATTERYALARM critical /ACTIVATE on /LEVEL 6 /ACTION hibernate
POWERCFG /DEVICEQUERY wake_armed
POWERCFG /DEVICEENABLEWAKE "Microsoft USB IntelliMouse Explorer"

After all this time, though, I should reinforce that your IsSystemResumeAutomatic tinapp never fails me. Combining that with GBPVRCLI to watch for recordings, the commandline standby options with SlimmGBPVR, and a daily automatic restart, and my system automation is sweet indeed.
keith_leitch Wrote:After all this time, though, I should reinforce that your IsSystemResumeAutomatic tinapp never fails me. Combining that with GBPVRCLI to watch for recordings, the commandline standby options with SlimmGBPVR, and a daily automatic restart, and my system automation is sweet indeed.

An odd development: After a year of faithful service, the tinyapp will no longer detect an automatic system resume. It seems to return an error level of 0 regardless of how the system awakes. This happened suddenly; one day it was "always right," and the next day, "always wrong." I can only conclude that a Windows Update has rooted me.
keith_leitch Wrote:An odd development: After a year of faithful service, the tinyapp will no longer detect an automatic system resume. It seems to return an error level of 0 regardless of how the system awakes. This happened suddenly; one day it was "always right," and the next day, "always wrong." I can only conclude that a Windows Update has rooted me.

Oh dear. It doesn't need to be run as an administrator or something does it? I'm not entirely sure what I can do to debug it. It literally contains a single line of code.
Mister Slimm Wrote:Oh dear. It doesn't need to be run as an administrator or something does it? I'm not entirely sure what I can do to debug it. It literally contains a single line of code.

Oh, well. It had a good run. I will watch over the next few days to see if there is some other factor in play.

I am running it from the same account as I always have, which has administrator privileges (but is not the administrator account).
Pages: 1 2 3 4 5