1
Good.
I have an AHK script that needed work, but it’s beyond what I can do. The question is simple, drip a website and in case of failure, present two information. One of them, the last time and date you were online. The second, warn with an X beep in X time that is offline.
I have this script (google.com used only for demo) and it works to check, with the GUI presenting 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
I’m quite new to programming, and I really have no idea what I can do to have the solution, I’m looking for ideas in that direction, or that can point me in the right direction, and I later follow it :) Hug
– NunoFernandes
Nor is it a matter of "being able to be", but if at least you gave a notion of the type "I located such a thing in the documentation, I inserted it this way" (put the code in the question) "and the result was such", it would make it easier for the staff to guide you and teach you what is missing. The way it is, I don’t see any other way but someone having to do it for you. If [Dit] and better describe what the next step you need to take and the difficulty, greatly increases the chance of a useful answer.
– Bacco
I understand, I’m not here "sucking the tit" :) At this point I’ve managed to do more or less what I wanted.. Already logs downtime in the file apart (registers checks), and already warns with beep. (version 2 above)
– NunoFernandes
remember that you can [Edit] the question at qq moment to add more details, code snippets etc (and take doubts so far by the comments).
– Bacco
Ah, and if you get an answer, you can post in the field below too, explaining how you solved it, if you want to leave the solution as a reference to other colleagues
– Bacco
Correct :) But here there is not much science, just read the manual and googlar examples. For the next ones I will explain in more detail :)
– NunoFernandes