variable not recognized in literal string Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
partof
Posts: 95
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: 552
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: 95
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”

Who is online

Users browsing this forum: aifritz, Bing [Bot], Chunjee, Google [Bot], JayOtt and 164 guests