As I mentioned before, I use the Microsoft Ergonomic Keyboard 4000 for my daily keyboard. I initially remapped three of the keys to control my Spotify, but I got intrigued by the power of AppleScript, and I tried to see what else I could do with it.
As I’m a huge fan of only using the keyboard, not a mouse (funny, because I’m using a Mac), I thought it would be cool to have an unlock button as well as a put to sleep button. After a little bit of research, this is what I came up with:
Sleep button:
on run {input, parameters}
tell application "Finder" to sleep
return input
end run
Unlock Button:
on run {input, parameters}
tell application "System Events"
keystroke "My Password!"
delay 0.25
key code 36
end tell
return input
end run
A side note, I changed my actual computer password with a placeholder (for obvious reasons). Although these programs may not seem impressive, they are not meant to be the next AI, but they are meant to serve a specific task, and they do it well.
You might also be thinking that having a button on your keyboard to unlock your computer is pretty risky, but the way I see it, my laptop is only connected to my keyboard in my house, and I don’t have anything on my laptop that I don’t mind anybody in my house seeing.