variable not recognized in literal string Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
partof
Posts: 110
Joined: 16 Jan 2016, 08:38

variable not recognized in literal string

09 Apr 2018, 09:58

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]
donovv
Posts: 108
Joined: 15 Apr 2017, 21:06

Re: variable not recognized in literal string

09 Apr 2018, 10:04

becuase they are between quotes

Code: Select all

"<span class='tooltip'>"%fronttext%"<span class='tooltiptext'>"%backtext% "</span></span>"
MaxAstro
Posts: 557
Joined: 05 Oct 2016, 13:00

Re: variable not recognized in literal string  Topic is solved

09 Apr 2018, 10:07

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>"
partof
Posts: 110
Joined: 16 Jan 2016, 08:38

Re: variable not recognized in literal string

09 Apr 2018, 10:09

thanks a lot for your help both of you!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: mikeyww, RussF and 191 guests