lock and unlock screen using aka.shell
Hi all,
so I'm not sure if this is even possible, but I'm trying to figure out how to use the aka.shell object to 'lock' my computer screen, and then later unlock the screen after some sort of action. One example would be using the cv.jit externals so that when a certain color is tracked the computer screen locks, and when a different color is tracked the computer screen unlocks. oh, and to be clear...by 'lock' and 'unlock' I do not mean activating a screensaver that requires a password or putting the computer to sleep, but rather something that completely locks a user out from accessing the computer or any applications on it. The ONLY way to unlock the screen must be automated by Max. I've done some googling about using applescripts to do this sort of thing and found that the following script locks the computer by bringing up the animated user login screen:
do shell script "/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend"
Unfortunately I don't know how to unlock this screen, or if there is another way of accomplishing this goal using other means. The bottom line is that the computer can't be usable at all (but application processes must still be running) unless the shell object executes a command to unlock it...I want the ultimate childproof system ;)
You could use the hi object to grab the mouse and the keyboard, rendering the computer non-receptive until the desired input arrives. Probably better than messing around with system login, security, etc.
You can pin the mouse to a certain position on the screen by repeatedly triggering "; max pupdate 50 50". Although this probably isn't the best way and won't disable the keyboard.
thanks for the advice guys—yes, i might try using the hi object in the future. I did manage to find some neat applescripts that can be run via aka.shell (i believe there is an applescript to hide and unhide the desktop, which would work perfectly). I just built a little patch which forces Logic Pro and all of my web browsers to stay hidden in the dock until I finish my work (ADHD ;)