Jump to content



Photo

How to lock computer at a certain time


  • Please log in to reply
9 replies to this topic

#1 Dinggus

Dinggus

    Neowinian Senior

  • Tech Issues Solved: 1
  • Joined: 11-January 05

Posted 02 April 2013 - 16:49

Is there a way I can schedule my computer to lock after a certain time of the day, and of course only unlock to a certain password?


#2 xendrome

xendrome

    In God We Trust; All Others We Monitor

  • Tech Issues Solved: 10
  • Joined: 05-December 01
  • OS: Windows 8.1 Pro x64

Posted 02 April 2013 - 16:59

Make a batch file and call it via task scheduler command is

"rundll32.exe user32.dll, LockWorkStation"

#3 Shadrack

Shadrack

    Neowinian Senior

  • Tech Issues Solved: 3
  • Joined: 20-December 01

Posted 02 April 2013 - 18:11

Make a batch file and call it via task scheduler command is

"rundll32.exe user32.dll, LockWorkStation"


Good luck doing that in Mac OS X.....

Here is one solution:

http://apple.stackex...t-lock-mac-os-x

I'm almost positive it can be done with Automator but I'm not at home to poke around. Lots of neat things can be done in Automator.

#4 Brian M.

Brian M.

    Neowinian Senior

  • Tech Issues Solved: 10
  • Joined: 07-January 05
  • Location: London, UK

Posted 02 April 2013 - 19:59

Easiest way is to stick a reference add a cronjob which references:

/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend

#5 sagum

sagum

    Unicorn Doctor

  • Joined: 09-October 08
  • Location: England
  • OS: Mac OS X 10.9 / Windows 7/8.1
  • Phone: LG E900 & Lumia` 610/520/920

Posted 02 April 2013 - 20:19

Easiest way is to stick a reference add a cronjob which references:

/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend


You're doing it wrong, he wants to lock his computer.. ;)

... Let do it properly. (this is for fun btw)

Go to http://www.maplin.co...-type-spst-2445 and buy a SPST.

Open the Computer case, and locate the power button. Cut the ONE of the wires. Drill a hole big enough for SPST and install in place. Run the cut wire from the power button one of the pins on the SPST and solder it on. Then using the cable that comes from the motherboard, solder that to the other pin on the SPST

note: If the wire isn't long enough for where you want to install it, you can you can order some more or just cut up an Ethernet cable and use the wire from the cords in there.

Now, you can actually use the SPST to lock the PC. Turn the PC off and you'll need to set the key to unlock it to turn it back on.


What you're doing here using a lockable switch. The switch (SPST) needs to be in the On position (unlocked) to allow the PC's momentary button to pass power to the motherboard when it's pressed. Without that, you can't turn the PC on without opening it up.

Later on you use the other pins hook up a robotic arm, along with an alarm clock connected to an old cell phone that you can text to lock and unlock the PC. Using an automated reminder service you can have the PC locked and unlocked automatically and you won't even need a password :D

#6 Shadrack

Shadrack

    Neowinian Senior

  • Tech Issues Solved: 3
  • Joined: 20-December 01

Posted 02 April 2013 - 23:56

^ :omg:

Brian M's solution is probably the best one. I thought there was a way to schedule periodic events in Automator, but the only thing close to that is to perform an action based on a calendar event.

According to:

This AppleScript will show the Login Window (essentially "lock" the computer): http://mac.sandman.n...wsAndLockScreen
do shell script "/System/Library/CoreServices/Menu Extras/User.menu/Contents/Resources/CGSession -suspend > /dev/null"

Using cron isn't very intuitive. I'm surprised that Apple has not implemented a better way of handling scheduled events by now, because I recall having to use cron for stuff in Tiger. Fortunately, cron is well documented as it is the main task scheduler for Darwin, other BSD distros, Linux, and probably other POSIX complaint operating systems.

#7 xendrome

xendrome

    In God We Trust; All Others We Monitor

  • Tech Issues Solved: 10
  • Joined: 05-December 01
  • OS: Windows 8.1 Pro x64

Posted 02 April 2013 - 23:59

Good luck doing that in Mac OS X.....


HAH didn't even realize this was in the Mac sub forum :) !

#8 OP Dinggus

Dinggus

    Neowinian Senior

  • Tech Issues Solved: 1
  • Joined: 11-January 05

Posted 06 April 2013 - 03:55

Thanks guys!

#9 Pedro3

Pedro3

    Neowinian

  • Joined: 02-August 04

Posted 06 April 2013 - 16:55

You can schedule events in iCal.

Just choose the hour and day (and everything else needed), then in the Alarms section choose "Script" and choose a Script that makes the Mac sleep.

#10 Jooshuaa

Jooshuaa

    Neowinian

  • Joined: 13-April 13

Posted 13 April 2013 - 04:33

You can use parental controls, just create another Administrator account. You can then schedual the computer to restart or shutdown or lock at any certain time, it will also set a time you can turn the computer back on or login again.