AutoHotkey Cookbook

From: https://gist.github.com/davejamesmiller/1965854

LockWorkStation(){
    Run rundll32.exe user32.dll`,LockWorkStation 
    Sleep, 1000
return
}
        
Also see: blank_screen() and in rare cases, Activate Screen-saver (Though unless you have a CRT, you just want to blank the screen).