Get domain from email address

Discussion, questions and support.
Post Reply
vrod5454
Posts: 20
Joined: Apr 18th, ’18, 02:13

Post by vrod5454 » Jun 11th, ’19, 17:47

Hi,

How can I grab the domain from an email address (via input box) and open that domain in a browser? My input will always be an email address. So in the input box I type I am using the code below to search for the email address using google. I would like to add code that will also open a new tab and go to the domain (website). So using the example above it would be somedomain.com

Code: Select all

InputBox, Input, Meta search, Prefixes: g`, who`,  ,250, 250
DivPos:=InStr(Input, " ")
Prefix:=SubStr(Input, 1, DivPos-1)
SearchText:=SubStr(Input, DivPos+1)
StringReplace, SearchText, SearchText, %A_Space%, `%20, All
StringReplace, SearchText, SearchText, #, `%23, All
SearchText:=Trim(SearchText)
if (Prefix="g")
{
	//Do something.
}
else if (Prefix="who")
{
	Run, "www.google.com/search?hl=en&q=%SearchText%" //open browser and searches google for the email address
	Run, "%SearchText%" //should open a new tab browser and go to the URL
}
return

Thanks for your help.
User avatar
Tom
Posts: 791
Joined: Nov 24th, ’15, 23:39

Post by Tom » Jun 12th, ’19, 19:58

Code: Select all

StringTrimLeft, domain, input, % InStr(input, "@")
run % "www." domain
;)
vrod5454
Posts: 20
Joined: Apr 18th, ’18, 02:13

Post by vrod5454 » Jun 20th, ’19, 15:45

Thanks Tom.

For future readers, I changed the run line to:

Code: Select all

Run, "www.%domain%"
User avatar
Marko
Posts: 1718
Joined: Mar 2nd, ’13, 21:02

Post by Marko » Jul 4th, ’19, 13:03

or

Code: Select all

Run www.%domain%
Post Reply