frozensun Posted May 15, 2008 Share Posted May 15, 2008 (edited) EDIT: Whoops, just realized this should have gone into the Code Example Forum. Can someone move it for me please?Hi Everyone,I've been using Autoit for a while, and one problem I've run into is not being able to script the dreaded "Computer Locked", aka ctrl+alt+del. I've tried all sorts of solutions, none of which have worked, until now, and I thought I would share with the community. I have not seen anyone else try this, but if you have, kudos to you :-) Essentially what I did was install a vnc server, allow local loopback connections, and a script to connect to myself (behind the scenes). Since the VNC folks already have a method to send the ctrl + alt + del, I thought that would be the most useful. Here is a basic walkthrough:1. Download and install TightVNC, both client and server.2. Right Click on the new VNC icon in the system tray.3. Click Properties.4. Set a password.5. Click Administration.6. Check "Allow Loopback Connections"7. Click okNow use the following code to create a script, filling in the appropriate passwords where required.CODE#cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.11.3 (beta) Author: Jason More Script Function: Unlock the computer using VNC#ce ----------------------------------------------------------------------------; Script Start - Add your code below heresleep(2000);slowing down the key presses helps with the connectionopt("SendKeyDelay",10);this should point to your tight vnc installationrun("C:\Program Files\TightVNC\vncviewer.exe","C:\Program Files\TightVNC") winwait("New TightVNC Connection")controlsend("New TightVNC Connection","","Edit1","localhost")controlclick("New TightVNC Connection","","Button5")winwait("Standard VNC Authentication");REQUIRED VNC PASSWORDcontrolsend("Standard VNC Authentication","","Edit3","Replace with your VNC password")controlclick("Standard VNC Authentication","","Button1")winwait(stringlower(stringlower(@ComputerName)))sleep("250")controlclick(stringlower(@ComputerName),"","ToolbarWindow321","left",1,124,13);REQUIRED USERNAME PASSWORDcontrolsend(stringlower(@ComputerName),"","ChildClass1","Replace with your Logon Password{Enter}")sleep("250")winclose(stringlower(@ComputerName))I hope this can help someone. Any questions let me know.Frozensun Edited May 15, 2008 by frozensun huanghaitao 1 Link to comment Share on other sites More sharing options...
akshataRao Posted June 15, 2009 Share Posted June 15, 2009 Thanks a Lot for the solution. Its works like a charm. However I wanted to put in a check if the system is locked or unlocked. If this script runs when the system is unlocked I see multiple windows so what do I need to check to know whether the system is locked ? Thanks in advance. Link to comment Share on other sites More sharing options...
LoWang Posted October 14, 2009 Share Posted October 14, 2009 yes I would like to know this too! Link to comment Share on other sites More sharing options...
LoWang Posted October 16, 2009 Share Posted October 16, 2009 I got it http://blogs.technet.com/heyscriptingguy/archive/2004/11/15/can-i-lock-a-workstation-using-a-script.aspx somewhere in the middle. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now