somdcomputerguy Posted October 13, 2010 Posted October 13, 2010 (edited) Well here's a script I wrote that I use daily, and maybe it'll be useful to someone else, either the script itself, or the code..Every n seconds, the source code of the page at URL is checked. If the text at Text doesn't exist, the script assumes the page has changed.There are three checkboxes, Open - passes URL to ShellExecute when a notification is acknowledged. Fade - The scripts GUI fades out when the 'Start' button is clicked. Beep on Change - provides an audible notification as well as the visual notification that appears on a 'page change'.Notification is acknowledged by pressing the 'End' key on your keyboard.The icons I'm using in the script are here, http://somdcomputerguy.com/pccicons.zip.This is what the GUI looks like.. <br><date.au3><inet.au3><constants.au3><editconstants.au3><guiconstantsex.au3><windowsconstants.au3><br></windowsconstants.au3></guiconstantsex.au3></editconstants.au3></constants.au3></inet.au3></date.au3> Edited October 16, 2010 by somdcomputerguy - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
somdcomputerguy Posted October 16, 2010 Author Posted October 16, 2010 expandcollapse popup#include <Date.au3> #include <INet.au3> #include <Constants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("TrayMenuMode", 3) Opt("GUIOnEventMode", 1) Opt("TrayOnEventMode", 1) Opt('MustDeclareVars', 1) Local $Form, $Label1, $Label2, $Label3, $Label4, $Input1, $Input2, $Input3, $Button1 _ , $TrayToggleHide, $TrayRestart, $TrayExit, $TrayStart, $Button2 _ , $CheckBox1, $CheckBox2, $CheckBox3, $sIniForumCheck = @AppDataCommonDir & "\forumcheck.ini" #Region ### START Koda GUI section ### $Form = GUICreate("Page Change Checker", 420, 120, 25, @DesktopHeight - 195, $WS_CAPTION, $WS_EX_TOOLWINDOW) GUISetIcon(@ScriptDir & "\Moderator.ico") GUISetOnEvent($GUI_EVENT_CLOSE, "Quit") $Label1 = GUICtrlCreateLabel("Seconds", 5, 16, 60, 17) $Label2 = GUICtrlCreateLabel("URL", 20, 40, 30, 17) $Label3 = GUICtrlCreateLabel("Text", 20, 70, 30, 17) $Label4 = GUICtrlCreateLabel("** Label **", 125, 15, 165, 20) $Input1 = GUICtrlCreateInput(IniRead($sIniForumCheck, "Settings", "Seconds", "90"), 75, 15, 40, 20, $ES_CENTER) GUICtrlSetOnEvent($Input1, "WriteToIni") $Input2 = GUICtrlCreateInput(IniRead($sIniForumCheck, "Settings", "URL", "http://forum.powweb.com/search.php?do=getnew"), 75, 45, 325, 20, $ES_CENTER) GUICtrlSetOnEvent($Input2, "WriteToIni") $Input3 = GUICtrlCreateInput(IniRead($sIniForumCheck, "Settings", "Text", "Sorry, there are no new threads to view."), 75, 70, 325, 20, $ES_CENTER) GUICtrlSetOnEvent($Input3, "WriteToIni") $Button1 = GUICtrlCreateButton("Start", 285, 10, 55, 23, $WS_GROUP) GUICtrlSetState($Button1, $GUI_FOCUS) GUICtrlSetOnEvent($Button1, "Start") $CheckBox1 = GUICtrlCreateCheckbox(" Open", 35, 90, 60) GUICtrlSetState($CheckBox1, $GUI_CHECKED) $CheckBox2 = GUICtrlCreateCheckbox(" Fade", 100, 90, 60) GUICtrlSetState($CheckBox2, $GUI_CHECKED) $CheckBox3 = GUICtrlCreateCheckbox(" Beep on Change", 200, 90, 130) GUICtrlSetState($CheckBox3, $GUI_CHECKED) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### #Region ### START Tray section ### $TrayToggleHide = TrayCreateItem("Show/Hide") TrayItemSetOnEvent($TrayToggleHide, "ToggleHide") $TrayRestart = TrayCreateItem("Restart") TrayItemSetOnEvent($TrayRestart, "ReStart") $TrayExit = TrayCreateItem("Exit") TrayItemSetOnEvent($TrayExit, "Quit") TraySetState() TraySetClick(9) TraySetIcon(@ScriptDir & "\Moderator.ico") TraySetToolTip(" Page Change Checker - Click here for the menu. ") TraySetOnEvent($TRAY_EVENT_MOUSEOVER, "MouseOverTray") #EndRegion ### START Tray section ### GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") While 1 Sleep(10) WEnd Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) Switch BitAND($wParam, 0xFFFF) Case $Button1 If ControlGetText("Page Change Checker", "", "Button1") = 'Restart' Then Restart() Case $GUI_EVENT_CLOSE Quit() EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND Func Start() GUICtrlSetState($Input1, $GUI_DISABLE) GUICtrlSetState($Input2, $GUI_DISABLE) GUICtrlSetState($Input3, $GUI_DISABLE) GUICtrlSetState($CheckBox2, $GUI_DISABLE) ControlSetText("Page Change Checker", "", "Button1", "Restart") If BitAND(GUICtrlRead($CheckBox2), $GUI_CHECKED) = $GUI_CHECKED Then For $vTrans = 250 To 5 Step -5 WinSetTrans("Page Change Checker", "", $vTrans) Sleep(10) Next WinSetState("Page Change Checker", "", @SW_HIDE) WinSetTrans("Page Change Checker", "", 255) EndIf While 1 Local $sCountdown = _DateAdd( 's', GUICtrlRead($Input1), _NowCalc()) TraySetToolTip(" Page Change Checker - Checking.. ") TraySetIcon(@ScriptDir & "\search2.ico") GUICtrlSetData($Label4, "Checking the page..") If StringInStr(_INetGetSource(GUICtrlRead($Input2)), GUICtrlRead($Input3)) = 0 Then TraySetToolTip(" Page Change Checker - Page Change!! ") GUICtrlSetData($Label4, "Page Change!!") TraySetIcon(@ScriptDir & "\check-mark-copy.ico") Actions() EndIf Sleep(Random(500, 1500, 1)) TraySetIcon("Hourglass.ico") Do Local $sCurrent = _NowCalc() ;#cs For $i = 1 to 10 TraySetIcon("hourglass" & $i & ".ico") Sleep(125) Next ;#ce Sleep(10) If $sCurrent <> _NowCalc() Then GUICtrlSetData($Label4, "Countdown.. " & _DateDiff( 's', _NowCalc(), $sCountdown)) TraySetToolTip(" Page Change Checker - Waiting.. " & _DateDiff( 's', _NowCalc(), $sCountdown) & " Click here for the menu. ") Until _DateDiff( 's', _NowCalc(), $sCountdown) <= 0 WEnd EndFunc ;==>Start Func Actions() If @HotKeyPressed = "{END}" Then HotKeySet("{END}") SplashOff() If BitAND(GUICtrlRead($CheckBox1), $GUI_CHECKED) = $GUI_CHECKED Then ShellExecute(GUICtrlRead($Input2)) ;Quit() ReStart() EndIf HotKeySet("{END}", "Actions") SplashTextOn("", "Page Change!!", 425, 100, -1, -1, 32, "", 18) For $c = 3 To 1 Step -1 ControlSetText("", "Page Change!!", "Static1", "Page Change!! {" & $c & "}") If BitAND(GUICtrlRead($CheckBox3), $GUI_CHECKED) = $GUI_CHECKED Then Beep(420, 420) Sleep(420) Next While 1 SplashOff() Sleep(500) SplashTextOn("Press 'End' to close this message", "Page Change!!", 425, 100, -1, -1, 32, "", 18) Sleep(1500) WEnd EndFunc ;==>Actions Func WriteToIni() ;ConsoleWrite(@GUI_CtrlId & @LF) Switch @GUI_CtrlId Case 7 IniWrite($sIniForumCheck, "Settings", "Seconds", GUICtrlRead($Input1)) Case 8 IniWrite($sIniForumCheck, "Settings", "URL", GUICtrlRead($Input2)) Case 9 IniWrite($sIniForumCheck, "Settings", "Text", GUICtrlRead($Input3)) EndSwitch EndFunc ;==>WriteToIni Func MouseOverTray() If BitAND(WinGetState("Page Change Checker", ""), 2) Then TrayItemSetText($TrayToggleHide, "Hide Page Change Checker Window") Else TrayItemSetText($TrayToggleHide, "Show Page Change Checker Window") EndIf EndFunc ;==>MouseOverTray Func ToggleHide() If BitAND(WinGetState("Page Change Checker", ""), 2) Then WinSetState("Page Change Checker", "", @SW_HIDE) Else WinSetState("Page Change Checker", "", @SW_SHOW) EndIf EndFunc ;==>ToggleHide Func ReStart() ;If ControlGetText("Page Change Checker", "", "Button1") = 'Start' Then Start() ; Restart your program - http://www.autoitscript.com/forum/index.php?s=&showtopic=19370&view=findpost&p=199608 ; Author UP_NORTH If @Compiled = 1 Then Run(FileGetShortName(@ScriptFullPath)) Else Run(FileGetShortName(@AutoItExe) & " " & FileGetShortName(@ScriptFullPath)) EndIf Exit EndFunc ;==>ReStart Func Quit() Exit EndFunc ;==>Quit - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
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