Page 1 of 1

variable not recognized in literal string

Posted: 09 Apr 2018, 09:58
by partof
The variable %fronttext% and %backtext% are seen as strings. Any idea why?

Code: Select all

[code=autohotkey file=Untitled.ahk]
#Include WinClipAPI.ahk
#Include WinClip.ahk

WinClip.Clear()
fronttext := "front text"
backtext := "back text"
html := "<span class='tooltip'> %fronttext% <span class='tooltiptext'> %backtext% </span></span>"

WinClip.SetHTML(html)
WinClip.Paste()
Return
[/code]

Re: variable not recognized in literal string

Posted: 09 Apr 2018, 10:04
by donovv
becuase they are between quotes

Code: Select all

"<span class='tooltip'>"%fronttext%"<span class='tooltiptext'>"%backtext% "</span></span>"

Re: variable not recognized in literal string  Topic is solved

Posted: 09 Apr 2018, 10:07
by MaxAstro
That won't work, either, since that line is in expression mode; Do this instead:

Code: Select all

"<span class='tooltip'>" . fronttext . "<span class='tooltiptext'>" . backtext . "</span></span>"

Re: variable not recognized in literal string

Posted: 09 Apr 2018, 10:09
by partof
thanks a lot for your help both of you!