JustinReno Posted February 28, 2008 Share Posted February 28, 2008 (edited) After seeing Swift's script (IEDisabler?), I thought that it just wasn't easy enough to add new web browsers efficently. So, I made a much simpler one using arrays. expandcollapse popupHotKeySet("`", "_Start") HotKeySet("~", "_Stop") $GetDefaultBrowser = RegRead("HKCR\HTTP\Shell\Open\Command", "") $GetLastSection = StringSplit($GetDefaultBrowser, "\") $GetProcessName = StringSplit($GetLastSection[$GetLastSection[0]], """") Global $InternetProcesses[3] = ["iexplore.exe", "firefox.exe", $GetProcessName[1]], $Started, $Start, $Password If RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run", "InternetDisabler") = 1 Then $Password = FileRead(@WindowsDir&"\InternetDisabler.txt") $Started = 1 FileDelete(@WindowsDir&"\InternetDisabler.txt") RegDelete("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run", "InternetDisabler") EndIf While 1 Sleep(10) If ProcessExists("TaskMgr.exe") Then ProcessClose("TaskMgr.exe") If $Started = 1 Then For $I = 0 To UBound($InternetProcesses) - 1 If ProcessExists($InternetProcesses[$I]) Then ProcessClose($InternetProcesses[$I]) MsgBox(16, $InternetProcesses[$I], "Internet has been disabled on your user account", 3) EndIf Next EndIf WEnd Func _Start() If $Start = 0 Then $Password = InputBox("Internet Disabler", "Please enter a password:", "", "*") $Started = 1 $Start = 1 EndFunc Func _Stop() $AskForPassword = InputBox("Internet Disabler", "Please enter your password:", "", "*") If $AskForPassword = $Password Then Exit If $AskForPassword <> $Password Then MsgBox(16, "Internet Disabler", "Incorrect.") EndFunc Func OnAutoItExit() If $Started = 1 Then If @Compiled = 0 Then RegWrite("HKEY_LOCAL_MACHINE\Softare\Microsoft\Windows\CurrentVersion\Run", "InternetDisabler", "REG_SZ", @AutoItExe & " " & @ScriptFullPath) If @Compiled = 1 Then RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run", "InternetDisabler", "REG_SZ", @ScriptFullPath) FileWrite(@WindowsDir&"\InternetDisabler.txt", $Password) EndIf EndFunc PS: Don't give me crap for this being just another "Justin" script. (You all know what I mean.) Edited March 1, 2008 by JustinReno Link to comment Share on other sites More sharing options...
James Posted February 28, 2008 Share Posted February 28, 2008 Not bad, but you should add more popular browsers or even better disable the connection whenever it is connected! Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Nutster Posted February 28, 2008 Share Posted February 28, 2008 Func OnAutoItExit() If @exitMethod = 0 Or 1 Or 2 Or 3 Or 4 And $Started = 1 Then If @Compiled = 0 Then RegWrite("HKEY_LOCAL_MACHINE\Softare\Microsoft\Windows\CurrentVersion\Run", "InternetDisabler", "REG_SZ", @AutoItExe & " " & @ScriptFullPath) If @Compiled = 1 Then RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run", "InternetDisabler", "REG_SZ", @ScriptFullPath) FileWrite(@WindowsDir&"\InternetDisabler.txt", $Password) EndIf EndFunc What you wrote looked like several comparisons with numeric values. When Or gets a number, it interprets it as False if it is 0 and True for any other number. What you wrote would always return True. David NuttallNuttall Computer Consulting An Aquarius born during the Age of Aquarius AutoIt allows me to re-invent the wheel so much faster. I'm off to write a wizard, a wonderful wizard of odd... Link to comment Share on other sites More sharing options...
GEOSoft Posted February 28, 2008 Share Posted February 28, 2008 You also might want to take a look at reading the registry to get the default browser then close that process HKCR\http\shell\open\command George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
LIMITER Posted February 29, 2008 Share Posted February 29, 2008 You could encrypt the password ... (for more safety ) Link to comment Share on other sites More sharing options...
JustinReno Posted March 1, 2008 Author Share Posted March 1, 2008 Cool, thanks for all of the feedback, its awesome! I'll look into everything you all said, thanks! Link to comment Share on other sites More sharing options...
JustinReno Posted March 1, 2008 Author Share Posted March 1, 2008 Updated! 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