responseText

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
maskeli
Posts: 33
Joined: 09 May 2020, 05:06

responseText

Post by maskeli » 15 May 2021, 14:01

here's my code guys.

Code: Select all

whr := ComObjCreate("WinHttp.WinHttpRequest.5.1")
whr.Open("GET", "https drive.google.com /uc?id=1iA2yEkOOlbfYjEEQy0leOk5y2BGx0mDL&export=download",  Broken Link for safety true)
whr.Send()
whr.WaitForResponse()
RegExMatch(whr.ResponseText, "gun(\d+) ay(\d+) yil(\d+)", sure)
msgbox hey
whr.Open("GET", "http worldtimeapi.org /api/timezone/Europe/Istanbul.txt",  Broken Link for safety true)
whr.Send()
whr.WaitForResponse()
RegExMatch(whr.ResponseText, "datetime: (\d+)-(\d+)-(\d+)T", saat)
when i shutdown the internet connection i get this error :
how can i fix this
Attachments
Adsız.png
the error
Adsız.png (25.41 KiB) Viewed 536 times

User avatar
mikeyww
Posts: 26599
Joined: 09 Sep 2014, 18:38

Re: responseText

Post by mikeyww » 15 May 2021, 14:41

You can use the Try command to avoid throwing an error.

ananthuthilakan
Posts: 188
Joined: 08 Jul 2019, 05:37
Contact:

Re: responseText

Post by ananthuthilakan » 16 May 2021, 04:41

and then you may use https://www.autohotkey.com/docs/commands/Catch.htm to do something else
for example show a internet error msg box

Code: Select all

try
{
whr := ComObjCreate("WinHttp.WinHttpRequest.5.1")
whr.Open("GET", "https drive.google.com /uc?id=1iA2yEkOOlbfYjEEQy0leOk5y2BGx0mDL&export=download",  Broken Link for safety true)
whr.Send()
whr.WaitForResponse()
RegExMatch(whr.ResponseText, "gun(\d+) ay(\d+) yil(\d+)", sure)
msgbox hey
whr.Open("GET", "http worldtimeapi.org /api/timezone/Europe/Istanbul.txt",  Broken Link for safety true)
whr.Send()
whr.WaitForResponse()
RegExMatch(whr.ResponseText, "datetime: (\d+)-(\d+)-(\d+)T", saat)

}
catch e  ; Handles the first error/exception raised by the block above.
{
		
		Sleep, 1000
		msgbox,NO INTERNET, NO INTERNET`n EXITING......
		ExitApp
   
}

Post Reply

Return to “Ask for Help (v1)”