status message of wifi connection

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
dukuzmo
Posts: 53
Joined: 25 Jul 2023, 14:02

status message of wifi connection

24 Mar 2024, 15:20

Hello, how can I do this (msgbox) in which I write a message that there is no Internet connection?

Code: Select all

whr.WaitForResponse
status := whr.status
if (status != 200)
   throw "Failed to download data. Status: " . status
how to avoid this message?
image.png
image.png (7.87 KiB) Viewed 76 times
ShatterCoder
Posts: 77
Joined: 06 Oct 2016, 15:57

Re: status message of wifi connection

25 Mar 2024, 09:48

In order to avoid the default error handling the easiest thing to do is use a try / catch block

Code: Select all

try
   whr.WaitForResponse
catch e 
{
   status := whr.status
   if (status != 200)
      throw "Failed to download data. Status: " . status
}

you can learn more about it in the docs here:
https://www.autohotkey.com/docs/v1/lib/Try.htm

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot], Descolada, Rohwedder and 77 guests