After nearly 15 years I retired my old Cherry keyboard and bought a new SteelSeries APEX MX500 keyboard with Cherry MX Red switches.
My old Cherry keyboard had a nice sleep button, wich I used all the time. The SteelSeries keyboard has a very minimalistic design and has no sleep button.
I decided to resort to an autohotkey hotkey to suspend the machine. I did not want to see the console executing the script so I made a VB executable that runs invisible. It is a Windows Forms application that hides the form on Load and executes Application.SetSuspendState. Just very simple.
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Me.Visible = False Application.SetSuspendState(PowerState.Hibernate, False, True) Me.Close() End Sub
I compiled a version for hibernate and another for sleep.
The autohotkey script is reacting to the Pause button for sleep and Alt+Pause for hibernate
; Run qsleep.exe on Pause key Pause:: Run, c:\util\davitools\qsleep.exe Return ; Run qhibernate.exe on Alt+Pause key !Pause:: Run, c:\util\davitools\qhibernate.exe Return
So now I can hit the Pause button to send the computer to sleep just like in the old days with my Cherry keyboard.
I made a zip with both QSleep.exe and QHibernate.exe, and the source code so you can inspect and build the tools yourself. I also included the autohotkey script.