Tuesday, August 31, 2010

3Dlock script

I have an idea to start publish the little programming code for Mac OS which could be useful in real life. There is no necessary to be a programmer to replicate it, just copy and paste the code. It maybe not interesting for everyone, but maybe for some experienced users.
The first code I'd like to present is 3Dlock. This funny 3D effect is well known in the internet, but could be useful in the office job when you leave the computer alone and would like to lock it from others. Any programs stay working in background while it is activated. Well, look on it.

I wrote the little code in AppleScript, but sure the Automator still in place too. It is not a "State of Art", any notes are welcome. I did two versions of this script in Automator and in AppleScript. The size of result is smaller for AppleScript variant. So I chose it.
Just start AppleScript on your system - copy and paste the code from here to there and push 'Compile' and 'Run' button. You'll see the 3D cube lock. Before 'Run' try to recall your account password. If you remember it go ahead. When you back from 3Dlock you can save it as 'Application' anywhere with 3Dlock name and drop it on your dock. Then if you need to activate the 3Dlock just click on your dock 3Dlock icon.
This is a code itself:
(* Lock your Mac OS by funny 3D effect *)
# The author is DimiG

set mySHELLcmd to POSIX path of file "System:Library:CoreServices:Menu Extras:User.menu:Contents:Resources:CGSession"

do shell script quoted form of POSIX path of mySHELLcmd & " -suspend"

No comments: