Autoit to Ahk (InetRead) Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
tm6464
Posts: 48
Joined: 17 Jul 2017, 22:56

Autoit to Ahk (InetRead)

20 Aug 2019, 14:31

hi all
can anyone help me make my autoit script to ahk
thx so much

Code: Select all

$sInput = InputBox("User", "Gib einen Usernamen ein:")
MsgBox(64, "Ausgabe", "Der User """ & $sInput & """ ist " & (_IsOnline($sInput) ? "nouser" : "ok") & ".")
Func _IsOnline($sChannelName)
	Return Not StringRegExp(BinaryToString(InetRead("http://api..com/php/getInfo/user=" & $sInput, 1)), _
				"(101|No users found|Invalid user Id|Invalid channel ID)")
EndFunc

User avatar
Sir Teddy the First
Posts: 94
Joined: 05 Aug 2019, 12:31
Contact:

Re: Autoit to Ahk (InetRead)

21 Aug 2019, 04:53

Hi,
here you go. This should be what you wanted:

Code: Select all

URL := "http://api..com/php/getInfo/user="
InputBox, sInput, User, Gib einen Usernamen ein:
MsgBox, 64, Ausgabe, % "Der User '" sInput "' ist " . Text := IsOnline(sInput) = 0 ? "nouser" : "ok" . "."
return

IsOnline(sInput)
{
	global URL
	
	UserRequest := ComObjCreate("WinHttp.WinHttpRequest.5.1")
	UserRequest.Open("GET", URL  sInput , true)
	UserRequest.Send()
	UserRequest.WaitForResponse()
	Response := UserRequest.ResponseText
	
	If !RegExMatch("101|No users found|Invalid user Id|Invalid channel ID", Response)
		return 1
	else
		return 0
}
:eh: :think:
tm6464
Posts: 48
Joined: 17 Jul 2017, 22:56

Re: Autoit to Ahk (InetRead)

22 Aug 2019, 06:53

thx a lot teddy
your code reads the http without problem the Response variabe have the right text but
" !RegExMatch " do not find it idk why, it always give back 1 no matter if the word is inside Response or not
teadrinker
Posts: 4331
Joined: 29 Mar 2015, 09:41
Contact:

Re: Autoit to Ahk (InetRead)  Topic is solved

22 Aug 2019, 07:16

Try:

Code: Select all

URL := "http://api..com/php/getInfo/user="
InputBox, sInput, User, Gib einen Usernamen ein:
MsgBox, 64, Ausgabe, % "Der User '" sInput "' ist " . IsOnline(URL, sInput) ? "ok" : "nouser"
return

IsOnline(URL, sInput)
{
   whr := ComObjCreate("WinHttp.WinHttpRequest.5.1")
   whr.Open("GET", URL  sInput , true)
   whr.Send()
   whr.WaitForResponse()
   Response := whr.ResponseText
   ; MsgBox, % Response
   Return !RegExMatch(Response, "i)\D101\D|No users found|Invalid user Id|Invalid channel ID")
}
tm6464
Posts: 48
Joined: 17 Jul 2017, 22:56

Re: Autoit to Ahk (InetRead)

22 Aug 2019, 17:49

thx for help guys

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], ShatterCoder, Xaucy and 173 guests