xSleep - suspend or hibernate your pc

Xlobby plugin development

xSleep - suspend or hibernate your pc

Postby S Pittaway on Fri Jun 09, 2006 1:38 pm

xSleep


This gives you an easy way of suspending or hibernating your pc.


Download link (including source code) -
http://www.xlobby.com/files/Marbles_00/ ... xSleep.zip (updated on 16 December 2006)





Functions are -

set on sleep command
This command will be run before the pc enters sleep (i use "command:xlobby:run event:system:on sleep" to run everything in my skins "on sleep" event group).

set on wake command
This command will be run when the pc is restored from sleep (i use "command:xlobby:run event:system:on wake" to run everything in my skins "on wake" event group).

suspend:sleep at time
This will put the pc into sleep mode at "sleep at time".

hibernate:sleep at time
This will put the pc into hibernating mode at "sleep at time".

In both these functions "sleep at time" can either be a date/time (12-22-2006 15:30, 12-22 2:45, 2:45 etc) or it can be a offset from now in minuites (30 = 30 mins, 0.5 = 30 seconds etc).



suspend time:time_string
This will wait utill the time specified in time_string and then put the pc into sleep mode.

hibernate time:time_string
This will wait utill the time specified in time_string and then put the pc into hibernate mode.

suspend mins:delay_in_mins
This will wait for delay_in_mins minuites and then put the pc into sleep mode.

hibernate mins:delay_in_mins
This will wait for delay_in_mins minuites and then put the pc into hibernate mode.

suspend secs:delay_in_secs
This will wait for delay_in_secs seconds and then put the pc into hibernate mode.

hibernate secs:delay_in_secs
This will wait for delay_in_secs seconds and then put the pc into hibernate mode.

ask
This pops up a dialog box (not skinned) which lets you select sleep options - suspend/hibernate/delay in secs/delay in mins/sleep time.

cancel
If a delayed sleep has been set this will cancel it.

priority:xxx
Set the priority of xlobby to be xxx, where xxx is one of -
ABOVENORMAL
BELOWNORMAL
HIGH
IDLE
NORMAL
REALTIME



Variables returned by the plugin are -

plugin>xSleep>sleep short time
This returns the short time at which the pc will sleep

plugin>xSleep>sleep short date
This returns the short date at which the pc will sleep

plugin>xSleep>sleep long time
This returns the long time at which the pc will sleep

plugin>xSleep>sleep long date
This returns the long time at which the pc will sleep

plugin>xSleep>sleep type
This returns either hibernate or suspend depending on what action was requested

plugin>xSleep>remaining time
This returns the amount of time (hh:mm:ss) left before the pc sleeps

plugin>xSleep>remaining sec
This returns the number of seconds left before the pc sleeps



Sean.
Last edited by S Pittaway on Sat Dec 16, 2006 9:25 pm, edited 1 time in total.
S Pittaway
 
Posts: 651
Joined: Wed Jan 25, 2006 11:08 am
Location: Manchester, England

Postby sagitaz on Sat Jun 17, 2006 12:42 am

hi :wink:

the window of configuration remains behind the setup of xlobby.

Thanks for this plugin.
sagitaz
 
Posts: 114
Joined: Mon Jul 05, 2004 11:17 pm

Postby PhilB on Sat Jun 17, 2006 1:07 am

I have not tried this but it might be useful. Question, have you tried using this and then "waking" the PC up by touching the touch screen?

Thanks,
PB
PhilB
 
Posts: 283
Joined: Sat Feb 18, 2006 6:38 pm

Postby S Pittaway on Sun Jun 18, 2006 9:05 am

sagitaz, i have a key on my remote which pops up the dialog:) but i will have a quick look, i guess that there is a always on top option that i have not set... i have also noticed that on the plugin i posted suspend and hibernate are not in the plugin command dropdown :)

PhilB, i wake up my pc using usb uirt, but a touch screen works in the same way as a mouse, so check the power options for it and see if there is an option to wake the pc.
S Pittaway
 
Posts: 651
Joined: Wed Jan 25, 2006 11:08 am
Location: Manchester, England

Postby Marbles_00 on Sun Nov 26, 2006 3:31 pm

Is this plugin working with the latest build? I thought I tried this plugin before and actually had it working, but now that I'm playing around with it again, I can't seem to get it to do anything.

One other question that I just want to make sure about. What is the proper time format? I may be entering it wrong in the event variable. Basically I want to shut my server down at 3:00am, until someone brings it out of standby.

Thanks in advance.
Marbles_00
 
Posts: 1867
Joined: Wed Apr 06, 2005 12:44 pm
Location: Canada

Postby S Pittaway on Mon Nov 27, 2006 8:28 am

I am using the latest (ie this weekend) build and it works fine for me...

Have you tried 3:00 ?

You can also do relative times like 120 = 2 hours etc, you may also be able top enter dates (i cant remember of the top of my head).
S Pittaway
 
Posts: 651
Joined: Wed Jan 25, 2006 11:08 am
Location: Manchester, England

Postby Marbles_00 on Tue Nov 28, 2006 7:09 am

Yep, format killed me again. Everything is 8) now.

Thanks.
Marbles_00
 
Posts: 1867
Joined: Wed Apr 06, 2005 12:44 pm
Location: Canada

Postby bmblank on Tue Nov 28, 2006 1:33 pm

[quote="S Pittaway"]plugin>xSleep>sleep long time
This returns the long time at which the pc will sleep

plugin>xSleep>sleep long date
This returns the long time at which the pc will sleep [/quote]

I found a typo.
Also, I have a laptop that won't work if it's not plugged in. I want to have this in my truck but I don't want it to kill my battery every time. Does either sleep or hibernate or suspend or whatever make it so it's not consuming any power, yet when I power it back up it'll be right back where I use to be?
bmblank
 
Posts: 233
Joined: Fri Jun 30, 2006 12:55 pm

Postby Marbles_00 on Tue Nov 28, 2006 2:44 pm

Sleep (or standby) puts your last state to RAM, so there will be a trickle power to keep the vitals of RAM running. When starting back up, everything just comes back on in a matter of seconds and a way you go.

Hibernate stores the last state onto the harddrive and then powers down. When restarting, it doesn't have to do a full Window's boot, but "resumes" where you left off.

Coming out of Sleep is by far the faster route, and for the amount of current required to keep the RAM going, well, it would most likely take a few weeks or months before it drained your truck battery to a level where you would need a boost to start. But if your really concerned about it, and don't care about load time, then use hibernate.
Marbles_00
 
Posts: 1867
Joined: Wed Apr 06, 2005 12:44 pm
Location: Canada

Postby Marbles_00 on Fri Dec 01, 2006 5:30 am

I noticed that the timer won't reset until midnight. So let's say I wan the server to sleep a 3:00am, and come morning the system is woken up, the timer to shut down won't initiate until 12:00 midnight again.

Is there a way to start the time when the computer is first woken back up again? Or is that a job for XEvent?
Marbles_00
 
Posts: 1867
Joined: Wed Apr 06, 2005 12:44 pm
Location: Canada

Postby S Pittaway on Fri Dec 01, 2006 8:05 am

I am not sure how old the version on here is i jiggled it arround a while ago, so it now uses DateTimes to work out when to sleep...

On the new version you can use dates and times to specify shutdown (ie. 3-12-2006 02:35), i also changed it to let you call "on sleep" and "on wake" commands....


If that sounds like it could be usefull i could ask Digi to upload the new version?

Or i could just stick the new code in here if you dont mind compiling it youself?
S Pittaway
 
Posts: 651
Joined: Wed Jan 25, 2006 11:08 am
Location: Manchester, England

Postby Marbles_00 on Fri Dec 01, 2006 5:12 pm

I think that is what I need.

I have nothing to compile the code so the raw source would be of little use for me :cry: . But I don't mind uploading for you, I have some space on the main xlobby server now.
Marbles_00
 
Posts: 1867
Joined: Wed Apr 06, 2005 12:44 pm
Location: Canada

Postby m_ski on Mon Dec 04, 2006 12:17 pm

Marbles,

If you have got .net then you have a command line compiler. Search for csc.exe, jsc.exe and vbc.exe within the .net install directories (windows\microsoft.net\...). I use these all the time to compile stuff when I don't have Visual Studio installed away from home.
m_ski
 
Posts: 204
Joined: Wed Dec 08, 2004 7:57 am
Location: Kent, United Kingdom

Postby Marbles_00 on Mon Dec 04, 2006 8:28 pm

That's 8) ! I never knew that we had simple compilers for visual basic, C# and Jscript. Thanks m_ski.

S Pittaway, if it is easier to just post the source, then I guess I can compile it myself. Whatever is easiest for you.
Marbles_00
 
Posts: 1867
Joined: Wed Apr 06, 2005 12:44 pm
Location: Canada

Postby S Pittaway on Tue Dec 05, 2006 7:58 am

its ok i will sort it out (when i get chance) :)
S Pittaway
 
Posts: 651
Joined: Wed Jan 25, 2006 11:08 am
Location: Manchester, England

Next