Jump to content

Background webpage checker


Dead_Man
 Share

Recommended Posts

so far this script is ~86% done, just have some problems ( the biggest being the background function )

general things i cant figure out:

  • Gray out the tray option 'Show Main Console' until in background mode

Background mode bugs:

  • Resume music after returning from background mode ( it just plays once and quits instead of going back to a loop )
  • Tray commands dont work when in background mode ( maybe because i use sleep(30000) for check delay? )
( i also sometimes get "IE.au3 V2.3-1 Warning from function _IECreate (Foreground Window Unlock Failed!)" when using the Refresh function but it still works )

also if you know a better way to write something then i wrote it please share

#include <GUIConstants.au3>
#include <Date.au3>
#include <IE.au3>
#Include <XSkin.au3> ;http://www.autoitscript.com/forum/index.php?showtopic=32494
#Include <Sound2.au3> ;http://www.autoitscript.com/forum/index.php?showtopic=30123
#Include <Constants.au3>
#NoTrayIcon
Opt("TrayMenuMode", 1)

$Skin_Folder = @ScriptDir & "\Skin\"

$sLongMonthName = _DateToMonth(@MON)

;@Mon returned "01" when i needed just "1", this is just a workaround
if $sLongMonthName = "January" Then
    $Month = 1
ElseIf $sLongMonthName = "February" Then
    $Month = 2
ElseIf $sLongMonthName = "March" Then
    $Month = 3
ElseIf $sLongMonthName = "April" Then
    $Month = 4
ElseIf $sLongMonthName = "May" Then
    $Month = 5
ElseIf $sLongMonthName = "June" Then
    $Month = 6
ElseIf $sLongMonthName = "July" Then
    $Month = 7
ElseIf $sLongMonthName = "August" Then
    $Month = 8
ElseIf $sLongMonthName = "September" Then
    $Month = 9
ElseIf $sLongMonthName = "October" Then
    $Month = 10
ElseIf $sLongMonthName = "November" Then
    $Month = 11
ElseIf $sLongMonthName = "December"  Then
    $Month = 12
EndIf

Global $sHTML
Global $CACHE
Global $Count
Global $Tray_Restore
Global $Month
Global $Website = "http://mavenswowaccounts.110mb.com/" & $Month & "-" & @MDay & "-08" & ".html"
Global const $Backgroundcolor = 0x313131
Global Const $Fontcolor = 0x23A795

ConsoleWrite("Current URL: " & $Website & @LF)

$XSkinGui = XSkinGUICreate( "Account Grabber", 600, 200, $Skin_Folder)
GUISetState(@SW_SHOW)
$refresh = XSkinButton("Refresh" ,20,50,90,20,"Refresh")
$Background_Mode = XSkinButton("B",500,12,13,17,"Background")
$Minimize = XSkinButton("_",515,12,13,17,"Minimize")
$Close = XSkinButton("X",530,12,13,17,"Close")
$Manage = XSkinButton("Change Password",120,50,100,20,"Password")
$Debug = GUICtrlCreateCheckbox("",480,12,13,17)
$Tray_Restore = TrayCreateItem("Show Main Console")
TrayCreateItem("")
$Tray_Close = TrayCreateItem("Exit")
$sound = _SoundOpen(@scriptdir & "/Sound/90d.wav", "loop")
_SoundPlay($sound, 0)

TraySetState()
while 1
    If _SoundPos($sound, 2) = _SoundLength($sound, 2) Then _SoundPlay($sound)
    $msg = GUIGetMsg()
    $traymsg = TrayGetMsg()
    MouseOver()


    Select
        Case $traymsg = 0
            ContinueLoop
        Case $traymsg = $Tray_Restore
            GUISetState(@SW_Show)
        Case $traymsg = $Tray_Close
            exit
    EndSelect
WEnd

func Refresh()
    if GUICtrlRead($Debug) = $GUI_CHECKED then
        $Website = "http://mavenswowaccounts.110mb.com/" & $Month & "-" & @MDay-2 & "-08" & ".html"
        ConsoleWrite("Using Website: " & $Website & "(DEBUGGER)" & @CRLF)
    ElseIf GUICtrlRead($Debug) = $GUI_UNCHECKED then
        $Website = "http://mavenswowaccounts.110mb.com/" & $Month & "-" & @MDay & "-08" & ".html"
        ConsoleWrite("Using Website: " & $Website & @CRLF)
    EndIf
    $oIE = _IECreate($Website,"",0)
    $size = InetGetSize($Website)
    $sHTML = _IEBodyReadText ($oIE)
    ProcessClose("iexplore.exe")
    $Edit = GUICtrlCreateEdit($sHTML,20,75,500,90,$ES_READONLY+$WS_VSCROLL)
    GUICtrlSetBkColor($edit,$Backgroundcolor)
    GUICtrlSetColor(-1,$Fontcolor)
    $CACHE = IniRead("Cache.ini","Website Cache","Filesize","")
    if $size = 6311 or $size = 0 Then
        TrayTip("Account Grabber", "Daily Accounts Have Not Been Uploaded.", 5, 1)
    elseif $size <> $CACHE then
        TrayTip("Account Grabber", "Website Updated!", 5, 1)
        IniWrite("Cache.ini","Website Cache","Filesize",$size)
    EndIf
EndFunc

func Background()
    $hide = GUISetState(@SW_Hide)
;   HotKeySet("{F6}","Restore") Would rather have it so you use the tray icon then pressing F6
    _SoundPause($sound)
        while $hide
            sleep(30000)
            ConsoleWrite("30 seconds" & @LF)
            $size = InetGetSize($Website)
            $CACHE = IniRead("Cache.ini","Website Cache","Filesize","")
            if $size = 6311 or $size = 0 Then
                GUIGetMsg()
            elseif $size <> $CACHE then
                TrayTip("Account Grabber", "Website Updated, loading new page now", 5, 1)
                IniWrite("Cache.ini","Website Cache","Filesize",$size)
                $oIE = _IECreate($Website,"",0)
                $size = InetGetSize($Website)
                $sHTML = _IEBodyReadText ($oIE)
                ProcessClose("iexplore.exe")
                ExitLoop
            EndIf
        WEnd
EndFunc
#cs
func Restore()
    GUISetState(@SW_SHOW)
    _SoundResume($sound)
    while 1
        If _SoundPos($sound, 2) = _SoundLength($sound, 2) Then _SoundPlay($sound)
    WEnd
EndFunc
#ce
Func Password()
    $oIE = ObjCreate("Shell.Explorer.2")
    $XSkinChildGUI = XSkinGUICreate("", 500, 500, $Skin_Folder)
    $Minimize = XSkinButton("_",415,12,13,17,"Minimize")
    $Close = XSkinButton("X",430,12,13,17,"Close2")
    $GUIActiveX = GUICtrlCreateObj ( $oIE, 20,50,460,420 )
    $oIE.navigate("https://www.worldofwarcraft.com/login/login?service=https%3A%2F%2Fwww.worldofwarcraft.com%2Faccount%2Fchange-password.html")
    GUISetState(@SW_SHOW)
EndFunc

Func Minimize()
    GUISetState(@SW_MINIMIZE)
EndFunc

Func Close()
    exit
EndFunc

func close2()
    GUISetState(@SW_hide)
EndFunc

if you want me make a rar with the files needed to run just ask

Edited by Dead_Man
Link to comment
Share on other sites

IE.au3 V2.3-1 is over a year out of date. Insure you are using the version that shipped with a recent version of AutoIt.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...