It is currently March 29th, 2024, 1:02 am
Sleep Command
-
- Posts: 19
- Joined: August 31st, 2012, 12:10 am
Sleep Command
Setting up a button to have the computer sleep when clicked. the hibernate command is not what i want to use, it takes too long on the computer to take effect, and its a long start up. Im looking for a command that simply puts the computer to sleep, like when you close the laptop.
-
- Posts: 446
- Joined: August 7th, 2012, 9:18 pm
Re: Sleep Command
I found this here
http://superuser.com/questions/39584/what-is-the-command-to-use-to-put-your-computer-to-sleep-not-hibernate
seems legit
http://superuser.com/questions/39584/what-is-the-command-to-use-to-put-your-computer-to-sleep-not-hibernate
seems legit
Powered by Sublime Text 3 with Rainmeter-Package
-
- Developer
- Posts: 22628
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Sleep Command
It is tricky to get a real "sleep" instead of "hibernate", but if you run this executable I just knocked out (source included) with:
LeftMouseUpAction=["#CURRENTPATH#SleepMe.exe"]
It should put your system to sleep.
AutoIt code:
LeftMouseUpAction=["#CURRENTPATH#SleepMe.exe"]
It should put your system to sleep.
AutoIt code:
Code: Select all
#RequireAdmin
ShellExecute("powercfg", "-hibernate off", "", "", @SW_HIDE)
Sleep(500)
ShellExecute("rundll32.exe", "powrprof.dll,SetSuspendState 0,1,0", "", "", @SW_HIDE)
You do not have the required permissions to view the files attached to this post.
-
- Posts: 310
- Joined: June 7th, 2012, 2:25 am
- Location: Philadelphia, PA
Re: Sleep Command
I use this for sleep. It doesnt go to hibernation.
LeftMouseUpAction=["#@#nircmd.exe" standby]
You will need NirCmd For this, But it was the only thing that I could find that put my computer to sleep instead of hibernation.
LeftMouseUpAction=["#@#nircmd.exe" standby]
You will need NirCmd For this, But it was the only thing that I could find that put my computer to sleep instead of hibernation.
-
- Posts: 19
- Joined: August 31st, 2012, 12:10 am
Re: Sleep Command
to jsmorley, how would the code for the actual button look? can you show a quick example skin of that? and where would you save the file for the sleepme.exe?
-
- Developer
- Posts: 22628
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Sleep Command
You could put the .exe in an @Resources\Addons folder under the folder with the skin's .ini file then use a meter like:createRyan wrote:to jsmorley, how would the code for the actual button look? can you show a quick example skin of that? and where would you save the file for the sleepme.exe?
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
[MeterSleep]
Meter=String
FontSize=50
FontColor=255,0,0,255
SolidColor=0,0,0,1
StringStyle=Bold
StringEffect=Shadow
AntiAlias=1
Text="You are feeling sleepy..."
LeftMouseUpAction=["#@#Addons\SleepMe.exe"]
Code: Select all
[Rainmeter]
Update=1000
[MeterSleep]
Meter=Image
ImageName=#@#Images\Sleep.png
ImageTint=210,210,210,255
MouseOverAction=[!SetOption MeterSleep ImageTint 255,255,255,255][!UpdateMeter MeterSleep][!Redraw]
MouseLeaveAction=[!SetOption MeterSleep ImageTint 210,210,210,255][!UpdateMeter MeterSleep][!Redraw]
LeftMouseUpAction=["#@#Addons\SleepMe.exe"]
https://docs.rainmeter.net/manual/skins/resources-folder/
You do not have the required permissions to view the files attached to this post.
-
- Posts: 478
- Joined: February 26th, 2011, 10:22 pm
Re: Sleep Command
Couldn't you just use a command line and call on a .BAT to execute it? Try opening up Notepad and pasting this into it...
Then save as... set All Files, then save it as Sleep.BAT to your skin's folder.
Now run the .BAT file by putting LeftMouseUpAction=!Execute ["#SKINSPATH#\[YourSkin]\Sleep.BAT"] as a command for the sleep button.
Code: Select all
powercfg -hibernate off
rundll32.exe powrprof.dll,SetSuspendState 0,1,0
Now run the .BAT file by putting LeftMouseUpAction=!Execute ["#SKINSPATH#\[YourSkin]\Sleep.BAT"] as a command for the sleep button.
Droptop Four
Dropdown menu bar & app launcher for Windows & Rainmeter
Dropdown menu bar & app launcher for Windows & Rainmeter
-
- Posts: 1
- Joined: September 19th, 2020, 10:36 pm
Re: Sleep Command
Hi, if I were to use the above code with an existing button along with your SleepMe.exe, where exactly do I put everything? I guess somehow I have to link that existing button to the codes above which will run the SleepMe.exe execution. Also, where do I add the SleepMe.exe if a complete Skin already exist? Sorry for all the questions, new to Rainmeter and not too sure where everything goes. Please advise!Put this:Code: Select all
[Rainmeter] Update=1000 [MeterSleep] Meter=Image ImageName=#@#Images\Sleep.png ImageTint=210,210,210,255 MouseOverAction=[!SetOption MeterSleep ImageTint 255,255,255,255][!UpdateMeter MeterSleep][!Redraw] MouseLeaveAction=[!SetOption MeterSleep ImageTint 210,210,210,255][!UpdateMeter MeterSleep][!Redraw] LeftMouseUpAction=["#@#Addons\SleepMe.exe"]
Sleep.png
In @Resources\Images under the folder with your skin's .ini file.
https://docs.rainmeter.net/manual/skins/resources-folder/
-
- Posts: 172
- Joined: July 8th, 2018, 8:05 pm
Re: Sleep Command
Let's suppose your skin is named "GoToSleep"DkNinja49 wrote: ↑September 19th, 2020, 10:42 pm Hi, if I were to use the above code with an existing button along with your SleepMe.exe, where exactly do I put everything? I guess somehow I have to link that existing button to the codes above which will run the SleepMe.exe execution. Also, where do I add the SleepMe.exe if a complete Skin already exist? Sorry for all the questions, new to Rainmeter and not too sure where everything goes. Please advise!
If you have a standard Rainmeter installation you'll find this folder:
C:\Users\"YourUserName"\Documents\Rainmeter\Skins\GoToSleep
Inside that folder will be the GoToSleep.ini file and, probably, another folder named @Resources; if the @Resources folder doesn't exist, you MUST create it.
Open then the C:\Users\"YourUserName"\Documents\Rainmeter\Skins\GoToSleep\@Resources folder and create (if are not already there...), 2 new folder, one named Images and the other Addons.
Now copy the SleepMe.exe file inside the Addons folder and the Sleep.png file inside the Images folder.
That's all regarding the files placement.
Now if you want to modify an existing skin you must select which meter will be your "trigger" to execute the SleepMe.exe file in the way exactly as jsmorley showed in his code.
If you can't figure it out, then you'll have to post here the skin code that you want to modify so someone will surely help you to accomplish the task
-
- Rainmeter Sage
- Posts: 5384
- Joined: April 12th, 2012, 9:40 pm
- Location: Cedar Point, Ohio, USA
Re: Sleep Command
brax64 beat me with an answer, so I will just expand it a bit...DkNinja49 wrote: ↑September 19th, 2020, 10:42 pm Hi, if I were to use the above code with an existing button along with your SleepMe.exe, where exactly do I put everything? I guess somehow I have to link that existing button to the codes above which will run the SleepMe.exe execution. Also, where do I add the SleepMe.exe if a complete Skin already exist? Sorry for all the questions, new to Rainmeter and not too sure where everything goes. Please advise!
Create your first skin shows you the steps to create a new skin. Follow those to have a basic skin open in your text editor. At that point, insert (copy and paste) the code for the sleep command from the forum post into that file and save it.
Follow brax64's steps (above) to place the exe and images.
Finally, 'Refresh All' in the Rainmeter MANAGE dialog. You will now see your new skin in the list and can load and test it.
:: My DA Gallery :: Rainmeter DA Gallery :: Rainmeter Workshops :: Rainmeter Documentation :: BBCode Guide ::