The T540p keyboard has a lock key, which locks the computer, but leaves the screen on. In order to save power, I wanted a quick way to lock the system and turn the screen off. I wrote an autohotkey script to do this. I find it helpful when I don’t want to sleep the computer due to a download or code running, but won’t be using it for a while. The T540p has a convenient lock button on the keyboard just issues the Left Windows Key and the ‘L’ Key. With this in mind, the below code locks and turns the monitor off when the below autohotkey script is running. I have Windows set to run the script on start-up. The latest version of the script is available on Github.

; Original from
; Edited by Jeremy Betz to use left win + L to turn off monitor with windows lock

; Left Win+L (Lock and turn monitor off)
Run rundll32.exe user32.dll`,LockWorkStation     ; Lock PC
Sleep 1000
SendMessage 0x112, 0xF170, 2, , Program Manager  ; Monitor off