putting a link in an email

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
sbrady
Posts: 105
Joined: 15 Mar 2014, 20:41
Location: Virginia Beach

putting a link in an email

17 Aug 2017, 09:18

I cant get a variable to show up as the real data in an email link, it shows up as %variable_here%.
I know its syntax but I cant figure out what it should be. see code below.

Code: Select all

// get user input
ControlGetText, UserInput, edit1  ;this will get the proj code in the textbox

//set variable name  userInput = ASIA20 New House
new_proj = %userInput%


;;;;;;;;;;;;;;;;;;;;;;;MAKE  EMAIL
msgbox, 4, , Send Email?`n`n`n`n

IfMsgBox Yes
	{
	Email_list :=  "[email protected];[email protected];[email protected]"
	m :=	ComObjCreate("Outlook.Application").CreateItem(0)
	m.To := Email_list
	m.cc := "[email protected]"
	m.Subject := new_proj " is created!      Click the link below"
	m.Body :=  "<a href = ""\\Features3.xxxxx.local\Features3\7Ci\%new_proj%""></a>"
	m.Display
	}

	else IfMsgBox No
	{
	return
	}
;;;;;;;;;;;;;;;;;;;;;;;;END MAKE  EMAIL


//text returned in email
<a href = "\\Features1.xxxxx.local\Features1\ATP\%new_proj%"></a>


//should be
<a href = "\\Features1.xxxxx.local\Features1\ATP\Asia20 New House"></a>
Nightwolf85
Posts: 302
Joined: 05 Feb 2017, 00:03

Re: putting a link in an email

17 Aug 2017, 09:28

Try Using:

Code: Select all

m.Body :=  "<a href = ""\\Features3.xxxxx.local\Features3\7Ci\" . new_proj . """></a>"
sbrady
Posts: 105
Joined: 15 Mar 2014, 20:41
Location: Virginia Beach

Re: putting a link in an email

17 Aug 2017, 09:33

is that SPACE . SPACE new_proj SPACE . SPACE

I'll try it now
sbrady
Posts: 105
Joined: 15 Mar 2014, 20:41
Location: Virginia Beach

Re: putting a link in an email

17 Aug 2017, 09:36

Nightwolf YOU ARE A GENIUS, YOU ARE A JEDI MASTER, YOU ARE ONE BAD *SS CODER, thank you very very much, saving me so much needless typing. thanks.
Nightwolf85
Posts: 302
Joined: 05 Feb 2017, 00:03

Re: putting a link in an email

17 Aug 2017, 09:43

sbrady wrote:Nightwolf YOU ARE A GENIUS, YOU ARE A JEDI MASTER, YOU ARE ONE BAD *SS CODER, thank you very very much, saving me so much needless typing. thanks.
You actually did the same type of concatenation yourself with the subject assignment:

Code: Select all

m.Subject := new_proj " is created!      Click the link below"
where you have new_proj " is created!..." the SPACE.SPACE is implied when using a single space between the variable and the string. (Meaning what you have is the same as new_proj . " is created!...")
sbrady
Posts: 105
Joined: 15 Mar 2014, 20:41
Location: Virginia Beach

Re: putting a link in an email

18 Aug 2017, 06:10

I tried this and it worked, this comes into the email as a link, click and it works. No need for <a href =
"\\Features1.cbn.local\Features1\ATP\"

But adding the last folder which is a variable, with . SPACE makes the link not work.
"\\Features1.cbn.local\Features1\ATP\" . new_proj

so I guess you really need <a href>. I tried to make it simplier, guess you cant.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: filipemb, Frogrammer, Google [Bot], mcd and 187 guests