I found an answer.
The Lock Screen app on Github does exactly what I wanted to do. So, by downloading it and adding this to my script, I can lock my monitor remotely:
run application "Lock Screen"
Edit: It seems the application runs the following script:
activate application "SystemUIServer"
tell application "System Events"
tell process "...
This should work on most versions
"/System/Library/CoreServices/Menu Extras/User.menu/Contents/Resources/CGSession" -suspend
osascript -e 'tell application "System Events" to sleep'
The -suspend line will switch to the login screen (which takes a few seconds, ...
I know of two ways (I use iPhone 6s plus):
Once you are in the locked screen you may press the volume button in intervals of few seconds as long as you want the screen to remain on.
You may alternatively slide to get your widget screen (that is on the left, right side is camera). You need to remove all items from the widget first. This will not stop the ...
This is almost as fast as having a lock script. Basically, just turn your ethernet interface(s) off/on.
in a terminal run 'sudo -s'
before locking run 'ifconfig en1 down'
after unlocking run 'ifconfig en1 up'
leave the terminal open but just minimize it for later use
if you don't know which is your active interface, run ifconfig and look for the entry ...