ludocus Posted June 27, 2009 Share Posted June 27, 2009 Hi everybody.. It's been a long time since I posted here This is very simple but effective.. When you try to open a window that's blocked, the window will hide and you will be prompted to enter a password.. If it's correct the window shows again, else it closes.. Check it out: expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.0.0 Author: Ludocus Script Function: Block windows with a password #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here Opt("WinTitleMatchMode", 1) ; = 1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase $nopasstime = 60000 ; = 1 minute (1000*60=60000) $num = 5 ; = number of titles $setpass = 'somepassword' ; = password for blocked window global $titles[$num+1] = ['Notepad', 'Calculator', 'Minesweeper', 'Windows Live Messenger', 'My documents'] While 1 sleep(200) $titlez = WinList() For $i = 1 to $titlez[0][0] For $p = 0 to ($num-1) if $titlez[$i][0] = $titles[$p] then if _Password($titlez[$i][0]) Then Sleep($nopasstime) Else WinClose($titlez[$i][0]) EndIf exitloop EndIf Next Next WEnd Func _Password($title) WinSetState($title, '', @SW_HIDE) $pass = InputBox('Forbidden!', 'Please enter your password', '', '*', 100, 100, -1, -1, 30) if $pass = $setpass then WinSetState($title, '', @SW_SHOW) return 1 EndIf return 0 EndFunc Link to comment Share on other sites More sharing options...
gseller Posted June 28, 2009 Share Posted June 28, 2009 Cool, it works on some things. Not on notepad or mydocuments. I am using vista x64.. Love it! Thanks for sharing Link to comment Share on other sites More sharing options...
nguyenbason Posted June 28, 2009 Share Posted June 28, 2009 Nice Idea but what if your script is terminated from Task Manager? UnderWorldVN- Just play the way you like it Link to comment Share on other sites More sharing options...
James Posted June 28, 2009 Share Posted June 28, 2009 Global $titles[$num + 1] = ['Untitled - Notepad', 'Calculator', 'Minesweeper', 'Windows Live Messenger', 'Documents'] Changed that for Windows 7/Vista. Notepad will work on any OS. This would be better if it worked through processes and not window titles. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
ludocus Posted June 28, 2009 Author Share Posted June 28, 2009 you could use: If ProcessExists('taskman.exe') Then ProcessClose('taskman.exe') or you could edit the registry: RegWrite ('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System', "DisableTaskMgr", "REG_DWORD", 1 ) (to enable taskmanager use: RegWrite ('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System', "DisableTaskMgr", "REG_DWORD", 0 ) Link to comment Share on other sites More sharing options...
Yashied Posted June 28, 2009 Share Posted June 28, 2009 I would add the following. if ($titlez[$i][0] = $titles[$p]) and (BitAnd(WinGetState($titlez[$i][1]), 2)) then My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
Zisly Posted June 28, 2009 Share Posted June 28, 2009 you could use:If ProcessExists('taskman.exe') Then ProcessClose('taskman.exe')or you could edit the registry:RegWrite ('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System', "DisableTaskMgr", "REG_DWORD", 1 )(to enable taskmanager use: RegWrite ('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System', "DisableTaskMgr", "REG_DWORD", 0 )Don't post things that could end up in the wrong lazy hands. Link to comment Share on other sites More sharing options...
slayerz Posted June 29, 2009 Share Posted June 29, 2009 Nice script but still need major improvement to be more secure. I did bypassed the security easily. Run the script, open My Documents. The script hide it and prompt for password. Without entering the password, try to open My Documents again, and the script will not hide it and not bothering for password again. AUTOIT[sup] I'm lovin' it![/sup] Link to comment Share on other sites More sharing options...
corgano Posted June 29, 2009 Share Posted June 29, 2009 This would be better if it worked through processes and not window titles.Yes, a much better idea. you could have it get the process of the window when setting the password and get the window of the process when the program is running, or something like that 0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e Link to comment Share on other sites More sharing options...
James Posted June 29, 2009 Share Posted June 29, 2009 Run the script, open My Documents. The script hide it and prompt for password. Without entering the password, try to open My Documents again, and the script will not hide it and not bothering for password again.That's because of this: If $titlez[$i][0] = $titles[$p] Then If _Password($titlez[$i][0]) Then Sleep($nopasstime) Else WinClose($titlez[$i][0]) EndIf ExitLoop EndIf It's sleeping till the password is entered. Yes, a much better idea. you could have it get the process of the window when setting the password and get the window of the process when the program is running, or something like thatWell that would bugger up any multi-lingual support. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ 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