Crome_BAD Posted February 20, 2005 Share Posted February 20, 2005 (edited) Ok, after alot of testing, and very, messy code. Its Done!expandcollapse popup#include <GUIConstants.au3> Global $a = 0 Global $b = 0 Global $c $INIValue = IniRead(@ScriptDir & "\Version.ini", "Version", "Version", "") ;Registry Settings ;================= $RKey = RegRead("HKEY_CURRENT_USER\Software\IEBlocker", "MainDir") $Version = RegRead("HKEY_CURRENT_USER\Software\IEBlocker", "Version") $Blocked = RegRead("HKEY_CURRENT_USER\Software\IEBlocker", "BlockedPages") SplashImageOn("", @ScriptDir & "\Skins\Startup\startup.jpg", 250, 100, -1, -1, 1) Update($Version) If $RKey = "" Then RegWrite("HKEY_CURRENT_USER\Software\IEBlocker", "", "REG_SZ", "") RegWrite("HKEY_CURRENT_USER\Software\IEBlocker", "MainDir", "REG_SZ", @ScriptDir) EndIf If $Version = "" Then RegWrite("HKEY_CURRENT_USER\Software\IEBlocker", "Version", "REG_SZ", $INIValue) EndIf If $Blocked = "" Then RegWrite("HKEY_CURRENT_USER\Software\IEBlocker", "BlockedPages", "REG_SZ", "0") EndIf ;======================================================================= Opt("WinTitleMatchMode", 2) $MainGUI = GUICreate("IE Blocker " & $Version, 400, 100) ;Background Picture ;================== GUICtrlCreatePic(@ScriptDir & "\Skins\b1.jpg", 0, 0, 400, 100, $GUI_DISABLE) ;IE Buttons ;========== $BlockIE = GUICtrlCreateButton("Block IE Pages", 5, 5, 100, 20) $StopBlock = GUICtrlCreateButton("Stop Block", 5, 25, 100, 20, $WS_DISABLED) $Exit = GUICtrlCreateButton("Exit", 5, 45, 100, 20) ;PC Time ;======== $TimeInput = GUICtrlCreateInput("", 220, 5, 170, 20, $WS_DISABLED) ;Webpages Blocked Input ;====================== $WebBlock = GUICtrlCreateInput("0 Webpage(s) Blocked", 240, 45, 150, 20, $WS_DISABLED) ;Previously Blocked Pages ;======================== GUICtrlCreateInput("Blocked Last Run: " & $Blocked, 240, 70, 150, 20, $WS_DISABLED) ;Update Button ;============= $UpdateB = GUICtrlCreateButton("Update", 5, 75, 100, 20) GUISetState() Sleep(1500) SplashOff() While 1 $msg = GUIGetMsg() If $msg = $Exit Then RegWrite("HKEY_CURRENT_USER\Software\IEBlocker", "BlockedPages", "REG_SZ", $a) Exit EndIf If $msg = $BlockIE Then GUICtrlSetState($BlockIE, $GUI_DISABLE) GUICtrlSetState($StopBlock, $GUI_ENABLE) GUICtrlSetState($Exit, $GUI_DISABLE) $b = 1 EndIf If $b = 1 Then If WinExists(" - Microsoft Internet Explorer") Then WinClose(" - Microsoft Internet Explorer") $a = $a + 1 GUICtrlSetData($WebBlock, $a & " Webpage(s) Blocked") EndIf EndIf If $msg = $StopBlock Then GUICtrlSetState($BlockIE, $GUI_ENABLE) GUICtrlSetState($StopBlock, $GUI_DISABLE) GUICtrlSetState($Exit, $GUI_ENABLE) $b = 0 EndIf If $msg = $UpdateB Then $c = 1 Update($Version) EndIf Call("Time") WEnd Func Time() $Hour = @HOUR $Min = @MIN $Sec = @SEC ;AM Or PM Check ;============== If $Hour = "12" And $Min = "00" And $Sec = "01" Or $Hour > "12" Then $NorD = "PM" Else $NorD = "AM" EndIf If $Hour > "12" Then $Hour = $Hour - 12 EndIf ;GUI Update ;========== GUICtrlSetData($TimeInput, "Current PC Time: " & $Hour & ":" & $Min & ":" & $Sec & " " & $NorD) EndFunc Func Update($Version) $IEVer = InetGet("http://www.autoitscript.com/fileman/users/public/Crome_BAD/IE%20Blocker/version.ini", @ScriptDir & "version.ini") $Read = IniRead(@ScriptDir & "\version.ini", "Version", "Version", "") If $Version < $Read Then $Msg = MsgBox(49, "New Update!", "Would You Like To Download Update?") If $Msg = 1 Then InetGet("http://www.autoitscript.com/fileman/users/public/Crome_BAD/IE%20Blocker/ieblocker.exe", @ScriptDir & "Temp\IEBlock.exe") $b = 1 EndIf EndIf If $b = 1 Then RegWrite("HKEY_CURRENT_USER\Software\IEBlocker", "Version", "REG_SZ", $Read) FileCopy(@ScriptDir & "\Temp\IEBlock.exe", @ScriptDir & "IEBlocker.exe") FileDelete(@ScriptDir & "\Temp") Exit EndIf If $c = 1 Then MsgBox(48, "No New Updates", "No New Updates At This Time") EndIf EndFuncThe WHOLE File AND Backgrounds:http://www.autoitscript.com/fileman/users/public/Crome_BAD/IE%20Blocker/ieblocker.zipAlso, Somemore commands people would like, or functionality, would be appreciated!Crome Edited February 21, 2005 by Crome_BAD Link to comment Share on other sites More sharing options...
Insolence Posted February 20, 2005 Share Posted February 20, 2005 expandcollapse popup;Time Conversions ;================ If $Hour = "00" Then $Hour = "12" EndIf If $Hour = "13" Then $Hour = "01" EndIf If $Hour = "14" Then $Hour = "02" EndIf If $Hour = "15" Then $Hour = "03" EndIf If $Hour = "16" Then $Hour = "04" EndIf If $Hour = "17" Then $Hour = "05" EndIf If $Hour = "18" Then $Hour = "06" EndIf If $Hour = "19" Then $Hour = "07" EndIf If $Hour = "20" Then $Hour = "08" EndIf If $Hour = "21" Then $Hour = "09" EndIf If $Hour = "22" Then $Hour = "10" EndIf If $Hour = "23" Then $Hour = "11" EndIf If $Hour = "24" Then $Hour = "12" EndIf C'mon, you gotta be able to find the pattern in that "I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar. Link to comment Share on other sites More sharing options...
therks Posted February 20, 2005 Share Posted February 20, 2005 Yeah that's hilarious that he'd actually type it all out. Not to mention that the hour never comes up as 24. My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
Crome_BAD Posted February 20, 2005 Author Share Posted February 20, 2005 (edited) its 4:30 AM, think my mind is workin? lol EDIT: lol omg i see, ill fix that in the mornin Edited February 20, 2005 by Crome_BAD Link to comment Share on other sites More sharing options...
Insolence Posted February 20, 2005 Share Posted February 20, 2005 expandcollapse popupFunc Loop1($BlockIE, $StopBlock, $TimeInput, $WebBlock, $Exit) GUICtrlSetData($WebBlock, "0 Webpage(s) Blocked") While 1 $msg = GUIGetMsg() If $msg = -3 Or $msg = $Exit Then $Previous = RegRead("HKEY_CURRENT_USER\Software\IEBlocker", "BlockedPages") RegWrite("HKEY_CURRENT_USER\Software\IEBlocker", "BlockedPages", "REG_SZ", ($Previous + $a)) Exit EndIf If $msg = $BlockIE Then GUICtrlSetState($BlockIE, $GUI_DISABLE) GUICtrlSetState($StopBlock, $GUI_ENABLE) GUICtrlSetState($Exit, $GUI_DISABLE) Loop2($BlockIE, $StopBlock, $TimeInput, $WebBlock, $Exit) EndIf Call("Time") Sleep(10) WEnd EndFunc Func Loop2($BlockIE, $StopBlock, $TimeInput, $WebBlock, $Exit) $a = 0 While 1 $msg = GUIGetMsg() If $msg = $StopBlock Then GUICtrlSetState($BlockIE, $GUI_ENABLE) GUICtrlSetState($StopBlock, $GUI_DISABLE) GUICtrlSetState($Exit, $GUI_ENABLE) Global $a = $a Loop1($BlockIE, $StopBlock, $TimeInput, $WebBlock, $Exit) EndIf If WinExists(" - Microsoft Internet Explorer") Then WinClose(" - Microsoft Internet Explorer") $a = $a + 1 GUICtrlSetData($WebBlock, $a & " Webpage(s) Blocked") EndIf Call("Time") Sleep(10) WEnd EndFunc That's even funnier... I really hope you fix that "I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar. Link to comment Share on other sites More sharing options...
Crome_BAD Posted February 20, 2005 Author Share Posted February 20, 2005 expandcollapse popup#include <GUIConstants.au3> ;Registry Settings ;================= $RKey = RegRead("HKEY_CURRENT_USER\Software\IEBlocker", "MainDir") $Version = RegRead("HKEY_CURRENT_USER\Software\IEBlocker", "Version") $Blocked = RegRead("HKEY_CURRENT_USER\Software\IEBlocker", "BlockedPages") If $RKey = "" Then RegWrite("HKEY_CURRENT_USER\Software\IEBlocker", "", "REG_SZ", "") RegWrite("HKEY_CURRENT_USER\Software\IEBlocker", "MainDir", "REG_SZ", @ScriptDir) EndIf If $Version = "" Then RegWrite("HKEY_CURRENT_USER\Software\IEBlocker", "Version", "REG_SZ", "v.03") EndIf If $Blocked = "" Then RegWrite("HKEY_CURRENT_USER\Software\IEBlocker", "BlockedPages", "REG_SZ", "0") EndIf ;======================================================================= Opt("WinTitleMatchMode", 2) $MainGUI = GUICreate("IE Blocker " & $Version, 400, 100) ;Background Picture ;================== GUICtrlCreatePic(@ScriptDir & "\Skins\b1.jpg", 0, 0, 400, 100, $GUI_DISABLE) ;IE Buttons ;========== $BlockIE = GUICtrlCreateButton("Block IE Pages", 5, 5, 100, 20) $StopBlock = GUICtrlCreateButton("Stop Block", 5, 25, 100, 20, $WS_DISABLED) $Exit = GUICtrlCreateButton("Exit", 5, 45, 100, 20) ;PC Time ;======== $TimeInput = GUICtrlCreateInput("", 220, 5, 170, 20, $WS_DISABLED) ;Webpages Blocked Input ;====================== $WebBlock = GUICtrlCreateInput("0 Webpage(s) Blocked", 240, 45, 150, 20, $WS_DISABLED) ;Previously Blocked Pages ;======================== GUICtrlCreateInput("Blocked Last Run: " & $Blocked, 240, 70, 150, 20, $WS_DISABLED) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $Exit Then RegWrite("HKEY_CURRENT_USER\Software\IEBlocker", "BlockedPages", "REG_SZ", $a) Exit EndIf If $msg = $BlockIE Then GUICtrlSetState($BlockIE, $GUI_DISABLE) GUICtrlSetState($StopBlock, $GUI_ENABLE) GUICtrlSetState($Exit, $GUI_DISABLE) Do $msg = GUIGetMsg() If WinExists(" - Microsoft Internet Explorer") Then WinClose(" - Microsoft Internet Explorer") $a = $a + 1 GUICtrlSetData($WebBlock, $a & " Webpage(s) Blocked") EndIf If $msg = $StopBlock Then GUICtrlSetState($BlockIE, $GUI_ENABLE) GUICtrlSetState($StopBlock, $GUI_DISABLE) GUICtrlSetState($Exit, $GUI_ENABLE) ExitLoop EndIf Call("Time") Sleep(10) Until 1 = 2 EndIf Call("Time") WEnd Func Time() $Hour = @HOUR $Min = @MIN $Sec = @SEC ;AM Or PM Check ;============== If $Hour = "12" And $Min = "00" And $Sec = "01" Or $Hour > "12" Then $NorD = "PM" Else $NorD = "AM" EndIf If $Hour > "12" Then $Hour = $Hour - 12 EndIf ;GUI Update ;========== GUICtrlSetData($TimeInput, "Current PC Time: " & $Hour & ":" & $Min & ":" & $Sec & " " & $NorD) EndFunc Alittle Better? Link to comment Share on other sites More sharing options...
Insolence Posted February 20, 2005 Share Posted February 20, 2005 Tons better But why do you go from a While loop to a Do loop? I think that looks tacky, but it's your script... "I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar. Link to comment Share on other sites More sharing options...
Crome_BAD Posted February 21, 2005 Author Share Posted February 21, 2005 ADDED: - Updater - Made Coder ALITTLE More Sexxier - Splash Startup - Added Default Skin More To Come Crome Also, More Suggestions welcome... Link to comment Share on other sites More sharing options...
Crome_BAD Posted February 21, 2005 Author Share Posted February 21, 2005 We are all here to learn, acouple people "explaining" my errors wont hurt me. Lol Only help me learn. 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