AHK - log in and notify with beep

1

Good.

I have an AHK script that I needed to improve, but it is beyond what I can do. The question is simple, dump a website and in case of failure, submit two information. One of them, the last hour and date we went online. The second, warn with a beep of X in time X that is offline.

I have this script (google.com used only for demo) and it works to check, with the GUI to present the information. How can I implement this in this script?

Thank you and hug!

Gui, +AlwaysOnTop

Gui, add, edit, vedit1 w400 h200 ;Remember asigning the variable

Gui, show

gosub, refresh

Settimer, refresh, 1000

return



refresh:

    Settimer, refresh, off

    Runwait %comspec% /c ping google.com >ping.txt,,hide

    FileRead, file, ping.txt

    FormatTime, now, , HH:mm:ss

    GuiControl,,edit1,%now%'n%file%

    Settimer, refresh, 1000

return

ExitApp

esc::ExitApp

Version 2:

Gui, +AlwaysOnTop
Gui, add, edit, vedit1 w400 h200
Gui, Show, , Checker Tool ; Create and display the GUI
gosub, refresh
Settimer, refresh, 1000
    return
        refresh:
            Settimer, refresh, off
            Runwait %comspec% /c ping google.com >ping.txt,,hide
            FileRead, file, ping.txt
            FormatTime, now, , HH:mm:ss
            GuiControl,,edit1,%now%'n%file%
            fileread, StrTemp, ping.txt

            if RegExMatch(StrTemp, "Average = (\d+)")
                Sleep 1000

            else

                SoundBeep, 750, 2000
                FileAppend, %A_YYYY%-%A_MM%-%A_DD% %A_Hour%:%A_Min%:%A_Sec%'n, downtime.txt

            Settimer, refresh, 1000
        return
    ExitApp
esc::ExitApp
    
asked by anonymous 27.09.2018 / 12:18

0 answers