cybie Posted April 3, 2005 Share Posted April 3, 2005 I use AutoIt a lot when I am at work, but I like to lock my computer using the (WinKey + L) when I am away from my desk. I needed a way to let my AutoIt apps and scripts run while I am away form my deak for maximum use of the automation, without appearing like the computer is "doing something magical" or looking like it is open to people stopping by to read my email... Enter the Phony Windows Lock-Out. This is just a VERY basic GUI script that will make it look like the computer has been locked, while it's not really locked at all, therefore allowing your apps to run and not be stopped by windows. This was put together quickly, so there may be issues, but I know it's something that I need so maybe you do too. :"> expandcollapse popup; ---------------------------------------------------------------------------- ; ; AutoIt Version: 3.1.1 (beta) ; Language: English ; Platform: WinXP ; Author: Cybie ; ; Script Function: ; Fake the "computer locked" dialog so that AutoIt may run in the background. ; ; ---------------------------------------------------------------------------- #include <GuiConstants.au3> HotKeySet("{F2}","KillSwitch") $LockImage = @TempDir & "/" & "locked.jpg" FileInstall("locked.jpg", $LockImage, 1) $SecurityImage = @TempDir & "/" & "security.jpg" FileInstall("security.gif", $SecurityImage, 1) $username = "MKTNG\yourname (Your Name)" ; GUI looks like background. GuiCreate("x", @DesktopWidth, @DesktopHeight, -1, -1, 0x80000000) GUISetBkColor (0x6E8ADE) GuiSetState() GUICreate("Computer Locked", 400, 200, -1, -1, 0x00000000) GUISetBkColor (0xE0E0C0) GUICtrlCreatePic ($LockImage, 0, 0, 400, 75) GUICtrlCreatePic ($SecurityImage, 10, 85, 32, 25) GUICtrlCreateLabel("This computer is in use and has been locked.",52,85,325,20) GUICtrlCreateLabel("Only " & $username & " or an administrator can unlock this computer.",52,105,325,40) GUICtrlCreateLabel("Press Ctrl-Alt-Del to unlock this computer.",52,145,325,20) GUISetState() $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() ;Keeps the computer from actually locking due to inactivity. $RandomMoveX = Random (1, @DesktopWidth) MouseMove ($RandomMoveX, @DesktopHeight) $RandomTime = Random (5000, 10000) Sleep($RandomTime) WinActivate("x") WinActivate("Computer Locked") Wend ;FUNCTIONS ;--------- Func KillSwitch() Exit 0 EndFunc NOTE: You will need to put the graphics attached to this post in the same directory as the script so that it may find them. Writing damaged code since 1996. Link to comment Share on other sites More sharing options...
buzz44 Posted April 3, 2005 Share Posted April 3, 2005 deceptive, but useful qq Link to comment Share on other sites More sharing options...
random667 Posted October 19, 2005 Share Posted October 19, 2005 (edited) Updated!!Go here for the current version:http://www.autoitscript.com/forum/index.ph...ic=10083&st=75# Edited October 27, 2005 by random667 It is really sad to see a family torn apart by something as simple as a pack of wolves. Link to comment Share on other sites More sharing options...
markusss Posted October 19, 2005 Share Posted October 19, 2005 Man that thing is great! I ran it without looking what the password is and couldn't close the program, NO matter what! Works really great! (I had to restart my Comp ) GJ Felix N. (tdlrali) Link to comment Share on other sites More sharing options...
Nuffilein805 Posted October 19, 2005 Share Posted October 19, 2005 lol thats great - just start the script without looking into it wanna open a real nice virus? my little chatmy little encryption toolmy little hidermy unsafe clickbot Link to comment Share on other sites More sharing options...
markusss Posted October 19, 2005 Share Posted October 19, 2005 No , i mean i looked at the stuff inside the script, but skipped the password and didn't remember it I know it was dumb, but after i clicked Run there was nothing i could do about it!^^ Link to comment Share on other sites More sharing options...
CyberSlug Posted October 19, 2005 Share Posted October 19, 2005 (edited) If you happened to have a script that relies on PixelGetColor or PixelChecksum, you could use WinSetTrans to make an ALMOST opaque window.... Edit to clarify: PixelGetColor "sees through" or ignores windows that have any degree of transparency. Example below; click the screen to close it: #include <GuiConstants.au3> $GUI = GuiCreate("foo", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP) ;Color Code from Josbe <http://www.autoitscript.com/forum/index.php?s=&showtopic=16243&view=findpost&p=111443> $out = DllCall("user32", "long", "GetSysColor", "long", 1);1==Background color $hColor = Hex( $out[0], 6); BGR output to RGB mode.... $hexColor = StringMid($hColor, 5, 2) & StringMid($hColor, 3, 2) & StringMid($hColor, 1, 2) GuiSetBkColor(Dec($hexColor)) GuiSetState() WinSetTrans($GUI, "", 254); one less than opaque While GuiGetMsg() <> $GUI_EVENT_PRIMARYDOWN sleep(100) WEnd Edited October 19, 2005 by CyberSlug Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
MSLx Fanboy Posted October 19, 2005 Share Posted October 19, 2005 (edited) I've been trying to figure out the check password thing. If the user does not have a password set, it WILL error out. Func ValidUserPassword($Password) Local $Previous_Run_Opt = Opt('RunErrorsFatal', 0) RunAsSet(@Username, '', 'default') $Valid_Password = RunWait(@Comspec & ' /c dir 1') Opt('RunErrorsFatal', $Previous_Run_Opt) Return Not $Valid_Password EndFunc That's not guaranteed, but it worked with my tests. Highly suggest this method for the user-password, as it allows for portability of pre-compiled code. For private purposes, a master override might not be a bad idea... Edited October 19, 2005 by MSLx Fanboy Writing AutoIt scripts since _DateAdd("d", -2, _NowCalcDate()) Link to comment Share on other sites More sharing options...
random667 Posted October 19, 2005 Share Posted October 19, 2005 (edited) i was trying to make it look as much like a regular windows login dialog as i could. i edited the script again, now when you type in the pass word the input text will be masked. i also removed the code to move the mouse around, as i can just go into the desktop settings and disable the login after screensaver option. the default password is "pass". i should have mentioned that in my post, as i am bad about running scripts with out readin through them. Edited October 20, 2005 by random667 It is really sad to see a family torn apart by something as simple as a pack of wolves. Link to comment Share on other sites More sharing options...
archrival Posted October 19, 2005 Share Posted October 19, 2005 (edited) Here's my take on this...See this post for au3 file http://www.autoitscript.com/forum/index.ph...ndpost&p=1179702K_High.bmp2K_Liner_High.bmp2K_Liner_Low.bmp2K_Low.bmpLock.icoXP_High.bmpXP_Liner_High.bmpXP_Liner_Low.bmpXP_Low.bmp Edited October 19, 2005 by archrival Link to comment Share on other sites More sharing options...
random667 Posted October 19, 2005 Share Posted October 19, 2005 (edited) archrival, i tried yours but it didnt work, i like the idea of the diffrent images. your script seems to look for the users name and password, but i dont see any inputs for the user to enter their name and password. Edited October 25, 2005 by random667 It is really sad to see a family torn apart by something as simple as a pack of wolves. Link to comment Share on other sites More sharing options...
archrival Posted October 19, 2005 Share Posted October 19, 2005 archrival, i tried yours but it didnt work, i like the idea of the diffrent images. your script seems to look for the users name and password, but i dont see any inputs for the user to enter their name and password.What didn't work exactly? It just pulls the current user name and domain, it's only for cosmetic purposes. I did notice that it doesn't work right with the latest beta. I had the same problem with the original though. Link to comment Share on other sites More sharing options...
random667 Posted October 19, 2005 Share Posted October 19, 2005 What didn't work exactly? It just pulls the current user name and domain, it's only for cosmetic purposes. I did notice that it doesn't work right with the latest beta. I had the same problem with the original though.When i ran the script nothing happened at all. It is really sad to see a family torn apart by something as simple as a pack of wolves. Link to comment Share on other sites More sharing options...
archrival Posted October 19, 2005 Share Posted October 19, 2005 When i ran the script nothing happened at all.You must be using 2000 then, I fixed an error, I was using WIN_2K instead of WIN_2000. Link to comment Share on other sites More sharing options...
random667 Posted October 19, 2005 Share Posted October 19, 2005 one problem with my script, although i have used WinMinimizeAll() firefox doesnt minimize when i run my script. It is really sad to see a family torn apart by something as simple as a pack of wolves. Link to comment Share on other sites More sharing options...
archrival Posted October 19, 2005 Share Posted October 19, 2005 Nope, im using my own modded version of xp pro corp.Don't know what to tell you then, works fine for me on all XP and 2000 machines I have tried it on. Link to comment Share on other sites More sharing options...
archrival Posted October 19, 2005 Share Posted October 19, 2005 (edited) not sure why it doesnt work for me,but i dont like the idea of someone hitting ctrl+alt+del or F2 to get around my login.a logon should require a password.Yeah, I just modified the original script, the display is almost identical to the actual "Computer Locked" dialog. That was my purpose. If someone wanted to modify it a little further, that's fine. Maybe it's a problem with the codebox, here's the actual au3 file. Edited October 25, 2005 by archrival Link to comment Share on other sites More sharing options...
random667 Posted October 19, 2005 Share Posted October 19, 2005 Yeah, I just modified the original script, the display is almost identical to the actual "Computer Locked" dialog. That was my purpose. If someone wanted to modify it a little further, that's fine. Maybe it's a problem with the codebox, here's the actual au3 file.understood,i will probably change my script to include your script to change the images dependant on the users OS,but i think using a password from the .ini file is best incase the user doesnt have a windows password setup (most people dont). It is really sad to see a family torn apart by something as simple as a pack of wolves. Link to comment Share on other sites More sharing options...
archrival Posted October 19, 2005 Share Posted October 19, 2005 I modified my posted au3 file to search for the actual full name of the user as well, which now requires use of the latest beta, also no longer moves the mouse in the lower left hand corner (sends a null character every 5 seconds). Link to comment Share on other sites More sharing options...
MSLx Fanboy Posted October 20, 2005 Share Posted October 20, 2005 Maybe I would suggest using the Windows password, if the code sample I posted above throws an error, fallback to a password in an ini file... i.e. If Not ValidUserPassword('mypassword')Then If $TestPassword = $PasswordFromIni Then $Allow_Access = True EndIf EndiF Just something to think about Writing AutoIt scripts since _DateAdd("d", -2, _NowCalcDate()) 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