#cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.8.1 Author: Craig Woodward AKA winter on weewar.com Script Function: Use the HQ API on weewar.com to check and see if any games need attention. #ce ---------------------------------------------------------------------------- #include $pid = ProcessExists("WeeWarDashboard.exe") If $pid Then If $pid <> @AutoItPID Then Exit;close since there is another running instance. EndIf ;Some global variables Global Const $READMODE = 0; Open a file to be read Global Const $WRITEMODE = 2; Open a file to be written to. Global $strCredentialsFile = @AppDataDir&"\WWD\WWCredentials.txt"; Global $strOptionsFile = @AppDataDir&"\WWD\Options.txt"; Global $strResultsFile = @AppDataDir&"\WWD\WWHQ.xml"; Global $strFolderPath = @AppDataDir&"\WWD\"; Global $strUserName = ""; Global $strAPIKey = ""; Global $boolManualCheck = $GUI_UNCHECKED; Global $numMinutes = 5; Minutes between checks user can set this later Global $playSound = $GUI_CHECKED; Global $strSoundFile = @WindowsDir&"\Media\Windows Notify.wav"; Global $boolShowPopUp = $GUI_CHECKED; Global $boolClosePopupOnClick = $GUI_UNCHECKED; Global $numNextCheck = 0; Global $timerGlobalTimer = TimerInit(); Global $strBrowserPath = RegRead("HKEY_LOCAL_MACHINE\Software\Clients\StartMenuInternet\IEXPLORE.EXE\shell\open\command", ""); assumes IE installed Opt("RunErrorsFatal",0); This stops the script from crashing if IE or FF is too busy to accept the link. Opt("TrayOnEventMode",1) ; Simplify checking for tray menu clicks Opt("TrayMenuMode",1) ; Default tray menu items (Script Paused/Exit) will not be shown. AutoItSetOption ( "GUICloseOnESC", 1); Allow the user to hit ESC to close the GUIs. TraySetToolTip("Starting, please wait"); Let the impatient user know we're still starting. ;Build up the Notification Tray icon Menu $CheckNowItem = TrayCreateItem("Check Now"); TrayItemSetOnEvent($CheckNowItem,"CheckNow"); TrayCreateItem("") $OpenHQItem = TrayCreateItem("Open HQ Web Page"); TrayItemSetOnEvent($OpenHQItem,"OpenHQ"); ;$OpenStatsItem = TrayCreateItem("Open Stats Graph Web Page"); ; TrayItemSetOnEvent($OpenStatsItem,"ShowStats"); ;TrayCreateItem("") $settingsItem = TrayCreateItem("Account Settings") TrayItemSetOnEvent($settingsItem,"Settings"); $optionsItem = TrayCreateItem("Options") TrayItemSetOnEvent($optionsItem,"SetOptions"); $aboutItem = TrayCreateItem("About") TrayItemSetOnEvent($aboutItem, "ShowAbout"); TrayCreateItem("") $exitItem = TrayCreateItem("Exit"); TrayItemSetOnEvent($exitItem,"ExitScript"); TraySetOnEvent (-13, "CheckNow" ); on double click TraySetState() TraySetClick(16);Right mouse up ;MAIN LINE BEGIN While (FileExists($strCredentialsFile)<>1) Settings(); WEnd ;Read the settings file for api key and user name $hSettingsFile = FileOpen($strCredentialsFile,$READMODE); $strUserName = FileReadLine($hSettingsFile); $strAPIKey = FileReadLine($hSettingsFile); FileClose($hSettingsFile); ;read the options file for the check period etc. If (FileExists($strOptionsFile) <> 0) Then $hOptionsFile = FileOpen($strOptionsFile,$READMODE); $boolManualCheck = FileReadLine($hOptionsFile); $boolClosePopupOnClick = FileReadLine($hOptionsFile); $playSound = FileReadLine($hOptionsFile); FileWriteLine($hSettingsFile,$playSound); $strSoundFile = FileReadLine($hOptionsFile); FileWriteLine($hSettingsFile,$strSoundFile); $boolShowPopUp = FileReadLine($hOptionsFile); $numMinutes = FileReadLine($hOptionsFile); $strBrowserPath = FileReadLine($hOptionsFile); FileClose($hOptionsFile); EndIf While (1==1); keep going till we stop. If ($boolManualCheck == $GUI_UNCHECKED) Then LogThis("Next check at: "&$numNextCheck); If ($numNextCheck <= TimerDiff($timerGlobalTimer)) Then CheckNow(); Else TraySetToolTip("Double click to check for games."&@CRLF&"Manual mode is enabled." ); EndIf Sleep(10000); ten seconds WEnd ;END OF MAIN LINE ;FUNCTIONS Func ShowStats() ; Open the little known stats page for the user. ShellExecute($strBrowserPath, "http://weewar.purepistos.net/rankings/graph/"&$strUserName); EndFunc Func OpenHQ() ; Open the user's HQ web page. ShellExecute($strBrowserPath, "http://weewar.com/headquarters/games"); Send("{ESC}"); EndFunc Func Settings() ; Create a window and get the user ID & API Key. Write the results out to a file. $hSettingsWindow = GUICreate ( "Weewar Account Settings" , 300 , 85); GUISetBkColor(0xFFFFFF,$hSettingsWindow); GuiSetIcon(@ScriptFullPath, 0) GUICtrlCreateLabel("User Name:",5,7,90); SetNormalTahomaFont(12,-1); $ctrlAPILabel = GUICtrlCreateLabel("API Token:",5,35,90); SetUnderlinedTahomaFont(12,$ctrlAPILabel); GUICtrlSetTip($ctrlAPILabel,"Click here to open your weewar account page to get your token"); $ctrlUserName = GuiCtrlCreateInput($strUserName, 95, 7,200,20); $ctrlTokenInput = GuiCtrlCreateInput($strAPIKey, 95, 36,200,20); $buttonTest = GUICtrlCreateButton("Test Settings", 185,58); $buttonOK = GUICtrlCreateButton("OK",255,58,40); ; GUI MESSAGE LOOP GuiSetState() $guiMsg = GUIGetMsg(); While $guiMsg <> $GUI_EVENT_CLOSE Select Case $ctrlAPILabel = $guiMsg ShellExecute($strBrowserPath, "http://weewar.com/apiToken"); Case $buttonTest == $guiMsg $strUserName = GUICtrlRead($ctrlUserName); $strAPIKey = GUICtrlRead($ctrlTokenInput); $testResults = InetGet ("http://"&$strUserName&":"&$strAPIKey&"@weewar.com/api1/headquarters",$strResultsFile, 1,1); While (@InetGetActive = 1) AnimateDownload() WEnd TraySetIcon(@ScriptFullPath,0); If ($testResults == 1) Then MsgBox(64,"Success", "Everything looks good!"); GUICtrlSetState($buttonOK,$GUI_ENABLE); Else MsgBox(16,"Uh Oh", "Something went wrong."&@CRLF&"Check your internet connection, proxy settings and user information"); GUICtrlSetState($buttonOK,$GUI_DISABLE); EndIf Case $buttonOK == $guiMsg DirCreate(@AppDataDir&"\WWD"); $hSettingsFile = FileOpen($strCredentialsFile,$WRITEMODE); $strUserName = GUICtrlRead($ctrlUserName); FileWriteLine($hSettingsFile,$strUserName); $strAPIKey = GUICtrlRead($ctrlTokenInput); FileWriteLine($hSettingsFile,$strAPIKey); FileClose($hSettingsFile); ExitLoop; Case Else ; EndSelect $guiMsg = GUIGetMsg(); WEnd GUISetState(@SW_HIDE,$hSettingsWindow); GUIDelete($hSettingsWindow); CheckNow(); EndFunc ;Create a window with options on it and then save the results to a file. Func SetOptions() ; This code added by Sandawg.----\/ ; This should get us a list of installed browsers from HKLM\Software\Clients\StartMenuInternet ; For each we need the name of the browser, which is a key under StartMenuInternet, and the path ; So an array makes sense. But there's probably a more elegant way than to assume a max of 12 and demarcate with "NULL" ; That's a future revision. Dim $Browsers[12][3]=[["NULL", "NULL", "NULL"], ["NULL", "NULL", "NULL"], ["NULL", "NULL", "NULL"], ["NULL", "NULL", "NULL"], ["NULL", "NULL", "NULL"], ["NULL", "NULL", "NULL"], ["NULL", "NULL", "NULL"], ["NULL", "NULL", "NULL"], ["NULL", "NULL", "NULL"], ["NULL", "NULL", "NULL"], ["NULL", "NULL", "NULL"], ["NULL", "NULL", "NULL"]] $i = 1 Do $Name = RegEnumKey("HKEY_LOCAL_MACHINE\Software\Clients\StartMenuInternet", $i) If @error <> 0 then ExitLoop $Browsers[$i][1] = $Name $Browsers[$i][2] = RegRead("HKEY_LOCAL_MACHINE\Software\Clients\StartMenuInternet\"&$Name&"\shell\open\command", "") $i += 1 Until $i = 12 ; Default browser is in HKLM\Software\Clients\StartMenuInternet "default" value, so look for it and grab it's path $Browsers[0][1] = RegRead("HKEY_LOCAL_MACHINE\Software\Clients\StartMenuInternet", "") $i = 1 While $Browsers[$i][1] <> $Browsers[0][1] $i += 1 WEnd $Browsers[0][2] = $Browsers[$i][2] ; Need to know how many browsers we have $NumBrowsers = 1 While $Browsers[$NumBrowsers][1] <> "NULL" $NumBrowsers += 1 WEnd $hOptionsWindow = GUICreate ( "Weewar Dashboard Options" , 380 , 153 + 20*$NumBrowsers); resize height based on number of installed browsers GUISetBkColor(0xFFFFFF,$hOptionsWindow); GuiSetIcon(@ScriptFullPath, 0) GUICtrlCreateLabel("Minutes between Checks:",5,7,184); SetNormalTahomaFont(12,-1); $ctrlMinutesInput = GUICtrlCreateInput($numMinutes,185,7,30,20); GUICtrlSetData($ctrlMinutesInput,$numMinutes); $ctrlManualCheck = GUICtrlCreateCheckbox("Only check when you double-click the tray icon.",5,35,370) SetNormalTahomaFont(12,$ctrlManualCheck); GUICtrlSetState($ctrlManualCheck,$boolManualCheck); $ctrlClosePopupCheck = GUICtrlCreateCheckbox("Close the pop up window when you click a link.",5, 55,375); SetNormalTahomaFont(12,$ctrlClosePopupCheck); GUICtrlSetState($ctrlClosePopupCheck,$boolClosePopupOnClick); $ctrlPopUpCheck = GUICtrlCreateCheckbox("Display a popup window",5,75,370); SetNormalTahomaFont(12,$ctrlPopUpCheck); GUICtrlSetState($ctrlPopUpCheck,$boolShowPopUp); $ctrlSoundCheck = GUICtrlCreateCheckbox("Play a sound when it's your turn",5,95,280); SetNormalTahomaFont(12,$ctrlSoundCheck); GUICtrlSetState($ctrlSoundCheck,$playSound); $ctrlMusicLabel = GUICtrlCreateLabel($strSoundFile,35,115,370); SetNormalTahomaFont(10,-1); $buttonOK = GUICtrlCreateButton("Save And Close",285,123 + 20*$NumBrowsers); $buttonSoundPick = GUICtrlCreateButton("Pick A Sound",285, 105); ; Dynamically set up browsers in GUI GUICtrlCreateLabel("Select browser to use:",5,145,184) SetNormalTahomaFont(12,-1); Dim $radio[$NumBrowsers + 1] $i = 1 While $Browsers[$i][1] <> "NULL" $radio[$i] = GUICtrlCreateRadio ($Browsers[$i][1], 10, 145 + 20*$i) If $strBrowserPath = $Browsers[$i][2] Then GUICtrlSetState($radio[$i], $GUI_CHECKED) EndIf $i += 1 WEnd GUISetState(@SW_SHOW,$hOptionsWindow); GuiSetState() $guiMsg = GUIGetMsg(); While $guiMsg <> $GUI_EVENT_CLOSE Select Case $ctrlSoundCheck == $guiMsg $playSound = GUICtrlRead($ctrlSoundCheck); Case $buttonSoundPick == $guiMsg $strSoundFile = FileOpenDialog("Select a Sound file", @WindowsDir&"\Media", "Sound Files (*.WAV; *.MP3)",3,"Windows Notify.wav") GUICtrlSetData($ctrlMusicLabel,$strSoundFile); SoundPlay($strSoundFile); Case $buttonOK == $guiMsg DirCreate(@AppDataDir&"\WWD"); $hOptionsFile = FileOpen($strOptionsFile,$WRITEMODE); $boolManualCheck = GUICtrlRead($ctrlManualCheck); $boolClosePopupOnClick = GUICtrlRead($ctrlClosePopupCheck); $playSound = GUICtrlRead($ctrlSoundCheck); $boolShowPopUp = GUICtrlRead($ctrlPopUpCheck); $boolManualCheck = GUICtrlRead($ctrlManualCheck); $numMinutes = GUICtrlRead($ctrlMinutesInput); FileWriteLine($hOptionsFile,$boolManualCheck); FileWriteLine($hOptionsFile,$boolClosePopupOnClick); FileWriteLine($hOptionsFile,$playSound); FileWriteLine($hOptionsFile,$strSoundFile); FileWriteLine($hOptionsFile,$boolShowPopUp); If (StringIsInt($numMinutes) == 1) Then ;Check to makesure user entered a number FileWriteLine($hOptionsFile,$numMinutes); Else FileWriteLine($hOptionsFile,5);If the user entered bad data use 5 minutes $numMinutes = 5; EndIf FileWriteLine($hOptionsFile,$strBrowserPath); FileClose($hOptionsFile); ExitLoop;Get out of the while loop and close the window. Case Else $i = 1 ; test the radio buttons While $radio[$i] <> $guiMsg $i += 1 If $i > $NumBrowsers Then ExitLoop; don't go past the end of the array! WEnd If $i <= $NumBrowsers Then ; if not then the GUI event wasn't a radio button If $Browsers[$i][1] <> "NULL" Then ; if NULL then user hasn't chosen a button $strBrowserPath = $Browsers[$i][2] EndIf EndIf EndSelect $guiMsg = GUIGetMsg(); WEnd $numNextCheck = ($numMinutes*60000)+TimerDiff($timerGlobalTimer); UpdateTimeStamp(); GUISetState(@SW_HIDE,$hOptionsWindow); GUIDelete($hOptionsWindow); EndFunc Func ShowAbout(); Show the about screen with the version number $hAboutWindow = GUICreate("About WeeWar Dashboard",400,101,-1,-1,$WS_CAPTION+$WS_POPUP+$WS_SYSMENU); GUISetBkColor(0xFFFFFF,$hAboutWindow); $ctrlID = GUICtrlCreateLabel("WeeWar Dashboard",5,5,300); SetNormalTahomaFont(16,$ctrlID); $ctrlID = GUICtrlCreateLabel("An application in AutoIt by Craig Woodward",5,35,350); SetNormalTahomaFont(12,$ctrlID); $ctrlID = GUICtrlCreateLabel("Version: "&FileGetVersion(@ScriptFullPath),5,55,250); SetNormalTahomaFont(12,$ctrlID); $ctrlID = GUICtrlCreateLabel("Website: ",5,75,60); SetNormalTahomaFont(12,$ctrlID); $linkCtrlID = GUICtrlCreateLabel("http://wwdb.sourceforge.net",75,75,210); GUICtrlSetColor($linkCtrlID, 0x0000ff);Blue GUICtrlSetFont($linkCtrlID,12, 400, 4, "Tahoma"); underlined tahoma GUICtrlSetCursor($linkCtrlID,0);pointer hand $picCtrlID = GuiCtrlCreatePic(@AppDataDir&"\WWD\weewar_corner_1.gif",325,0,75,101); GUICtrlSetCursor($picCtrlID,0);pointer hand GUISetState(); $msg = GUIGetMsg(1); While $msg[0] <> $GUI_EVENT_CLOSE If ($msg[0] > 0) Then If ($msg[0] == $linkCtrlID) Then ShellExecute($strBrowserPath, GUICtrlRead($msg[0])); If ($msg[0] == $picCtrlID) Then ShellExecute($strBrowserPath, "http://weewar.com/user/winter?referrer=winter"); EndIf $msg = GUIGetMsg(1); WEnd GUISetState(@SW_HIDE,$hAboutWindow); GUIDelete($hAboutWindow); EndFunc Func CheckNow() ; Check if any games are 'inNeedOfAttention' $numNextCheck = ($numMinutes*60000)+TimerDiff($timerGlobalTimer); $hoursDelta = 0; $minutes = @MIN+$numMinutes; While ($minutes > 59) $minutes -= 60; $hoursDelta += 1; WEnd TraySetToolTip("Checking now..."); InetGet ("http://"&$strUserName&":"&$strAPIKey&"@weewar.com/api1/headquarters",$strResultsFile, 1,1);;Get the .xml file While (@InetGetActive = 1);wait for the download the complete AnimateDownload();flash the systray RSS icon, seems appropriate WEnd If ($minutes <10) Then;prepend a 0 to the minutes TraySetToolTip("Last check was at "&@HOUR&":"&@MIN&@CR&"Next check will be at "&@HOUR+$hoursDelta&":0"&$minutes ); Else TraySetToolTip("Last check was at "&@HOUR&":"&@MIN&@CR&"Next check will be at "&@HOUR+$hoursDelta&":"&$minutes ); EndIf If (FileExists($strResultsFile) <> 0) Then; We got the file TraySetIcon(@ScriptFullPath,0); $hResultsFile = FileOpen($strResultsFile, $READMODE); $strTrayTipText = ""; If ($hResultsFile <> -1) Then SetError(0); $line = FileReadLine($hResultsFile); While (@error <> -1);build the pop up window text If (StringInStr($line,'inNeedOfAttention="true"')<>0) Then While (StringInStr($line,'') == 0) $line = FileReadLine($hResultsFile); $line = CleanUpEnconding($line); WEnd $strGameName = StringTrimLeft(StringTrimRight($line,7),6); While (StringInStr($line,'') == 0) $line = FileReadLine($hResultsFile); WEnd $strGameLink = StringTrimLeft(StringTrimRight($line,7),6); $strTrayTipText = $strTrayTipText&$strGameName & @CR & $strGameLink&@CR; EndIf ;Check for any anomolies that mean the site is down for maintenance or just broken If (StringInStr($line,"The gears of Weewar are being oiled")<>0) Then;The site is down for maintenance If ($minutes <10) Then TraySetToolTip("The gears of Weewar are being oiled."&@CR&"Next check will be at "&@HOUR+$hoursDelta&":0"&$minutes ); Else TraySetToolTip("The gears of Weewar are being oiled."&@CR&"Next check will be at "&@HOUR+$hoursDelta&":"&$minutes ); EndIf TraySetIcon(@AppDataDir&"\WWD\GOW.ico"); ExitLoop ElseIf (StringInStr($line,"Oops! An error occurred:")<>0) Then; The API is returning an error If ($minutes <10) Then TraySetToolTip("The Weewar API is reporting it's experienced an error."&@CR&"WWDb is working correctly."&@CR&"Next check will be at "&@HOUR+$hoursDelta&":0"&$minutes ); Else TraySetToolTip("The Weewar API is reporting it's experienced an error."&@CR&"WWDb is working correctly."&@CR&"Next check will be at "&@HOUR+$hoursDelta&":"&$minutes ); EndIf TraySetIcon(@AppDataDir&"\WWD\Script-error.ICO"); ExitLoop Else TraySetIcon(@ScriptFullPath,0); EndIf $line = FileReadLine($hResultsFile); WEnd ;Next line is for debugging, can simulate games needing attention. ;$strTrayTipText = "8th Floor special"&@CR&"http://cluster.weewar.com/game/20250"&@CR&"Battle Royale"&@CR&"http://cluster.weewar.com/game/21660"&@CR; If ($strTrayTipText <> "") Then;we found some games and we need to display the popup window TraySetIcon(@AppDataDir&"\WWD\DFA-Green.ICO");Set the green tray icon and display the pop-up window If ($playSound = $GUI_CHECKED) Then SoundPlay($strSoundFile); If ($boolShowPopUp = $GUI_CHECKED) Then ShowGamesPopup($strTrayTipText); EndIf FileClose($hResultsFile); EndIf FileMove($strResultsFile, $strResultsFile&".bak",1); by moving the file it can be used for debugging if needed Else TraySetIcon(@AppDataDir&"\WWD\DFA-Red.ICO"); If ($minutes <10) Then TraySetToolTip("Error connecting on last attempt at "&@HOUR&":"&@MIN&@CR&"Next check will be at "&@HOUR+$hoursDelta&":0"&$minutes ); Else TraySetToolTip("Error connecting on last attempt at "&@HOUR&":"&@MIN&@CR&"Next check will be at "&@HOUR+$hoursDelta&":"&$minutes ); EndIf EndIf EndFunc Func ShowGamesPopup($strText) $blankLines = 0; $arrStrings = StringSplit($strText,@CR,1); $arrTBSize = WinGetClientSize ( "[CLASS:Shell_TrayWnd]"); get the task bar sizes $TaskbarHeight = $arrTBSize[1]; get the y axis dimension (height) of the task bar. If ($TaskbarHeight == @DesktopHeight) Then $TaskbarHeight = 0;If they have the task bar along the side of the screen $hPopupWindow = GUICreate("It's your turn...",235,($arrStrings[0]-1)*20+5,@DesktopWidth-241,@DesktopHeight-($TaskbarHeight+29)-(($arrStrings[0]-1)*20),$WS_CAPTION+$WS_POPUP+$WS_SYSMENU,$WS_EX_TOOLWINDOW+$WS_EX_TOPMOST);;,$WS_POPUP); GUISetBkColor ( 0xFFFFFF,$hPopupWindow);white background For $i = 1 To $arrStrings[0]; build the popup window If ($arrStrings[$i] <> "") Then; Make labels $ctrlID = GUICtrlCreateLabel($arrStrings[$i],5,(5+(20*($i-1-$blankLines))),235,20,$SS_NOPREFIX ); game name SetNormalTahomaFont(9,$ctrlID); If (StringInStr(GUICtrlRead($ctrlID),"weewar.com/game/") <>0) Then ; game link SetUnderlinedTahomaFont(9,$ctrlID); EndIf Else $blankLines = $blankLines+1; EndIf Next GUISetState(@SW_SHOWNOACTIVATE,$hPopupWindow);Show, but don't grab focus $guiMsg = 0; $guiMsg = GUIGetMsg(1); While $guiMsg[0] <> $GUI_EVENT_CLOSE If ($guiMsg[0] > 0) Then If (StringInStr(GUICtrlRead($guiMsg[0]),"weewar.com/game/") <>0) Then ;it's a game link so open it ShellExecute($strBrowserPath, GUICtrlRead($guiMsg[0])); If ($boolClosePopupOnClick == $GUI_CHECKED) Then ExitLoop;Close the Window EndIf EndIf $guiMsg = GUIGetMsg(1); Sleep(10); If ($numNextCheck <= TimerDiff($timerGlobalTimer)) Then ExitLoop;Close popup when it's time to check for games again. WEnd GUISetState(@SW_HIDE,$hPopupWindow); Hide the window GUIDelete($hPopupWindow); Clean up the window and it's contents to reduce memeory footprint TraySetIcon(@ScriptFullPath,0) EndFunc Func SetNormalTahomaFont($size,$ctrlID) GUICtrlSetBkColor ($ctrlID,$GUI_BKCOLOR_TRANSPARENT ); GUICtrlSetFont ($ctrlID,$size, 400, 0, "Tahoma") ;regular Tohoma EndFunc Func SetUnderlinedTahomaFont($size,$ctrlID) GUICtrlSetColor( $ctrlID, 0x0000ff);Blue GUICtrlSetFont ($ctrlID,$size, 400, 4, "Tahoma"); underlined tahoma GUICtrlSetCursor($ctrlID,0);pointer hand GUICtrlSetBkColor ($ctrlID,$GUI_BKCOLOR_TRANSPARENT ); EndFunc Func LogThis($strToLog);For debugging ;$hLogFile = FileOpen(@ScriptDir&"\LogFile.txt",1) ;FileWriteLine($hLogFile,@HOUR&":"&@MIN&":"&@SEC&" - "&$strToLog); ;FileClose($hLogFile); EndFunc Func AnimateDownload() TraySetIcon(@ScriptDir&"\download-1.ico"); Sleep(100); TraySetIcon(@ScriptDir&"\download-2.ico"); Sleep(100); TraySetIcon(@ScriptDir&"\download-3.ico"); Sleep(100); TraySetIcon(@ScriptDir&"\download-3.ico"); Sleep(100); TraySetIcon(@ScriptDir&"\download-2.ico"); Sleep(100); TraySetIcon(@ScriptDir&"\download-1.ico"); Sleep(100); EndFunc Func CleanUpEnconding($strInput) ;& ? & (ampersand, U+0026) ;< ? < (less-than sign, U+003C) ;> ? > (greater-than sign, U+003E) ;" ? " (quotation mark, U+0022) ;' ? ' (apostrophe, U+0027) ;( (left quote, Base-10, 40) ;) (right quote, Base-10, 41) $strWorking = ""; $strWorking = StringReplace($strInput, "'", "'"); $strWorking = StringReplace($strWorking, """, '"'); $strWorking = StringReplace($strWorking, ">", ">"); $strWorking = StringReplace($strWorking, "<", "<"); $strWorking = StringReplace($strWorking, "&", '&'); $strWorking = StringReplace($strWorking, "(", '('); $strWorking = StringReplace($strWorking, ")", ')'); Return $strWorking; EndFunc Func UpdateTimeStamp() If ($boolManualCheck == $GUI_UNCHECKED) Then $numNextCheck = ($numMinutes*60000)+TimerDiff($timerGlobalTimer); $hoursDelta = 0; $minutes = @MIN+$numMinutes; While ($minutes > 59) $minutes -= 60; $hoursDelta += 1; WEnd If ($minutes <10) Then;prepend a 0 to the minutes TraySetToolTip("Next check will be at "&@HOUR+$hoursDelta&":0"&$minutes ); Else TraySetToolTip("Next check will be at "&@HOUR+$hoursDelta&":"&$minutes ); EndIf Else TraySetToolTip("Double click to check for games."&@CRLF&"Manual mode is enabled." ); EndIf EndFunc Func ExitScript() ; Exit called by the menu GUIDelete(-1); Exit EndFunc