ActiveX(HTML), how to underline a paragraph, change a sentence's background color and some words' font color Topic is solved
ActiveX(HTML), how to underline a paragraph, change a sentence's background color and some words' font color
I want to use teadrinker's HoverScrollbarGui()viewtopic.php?f=82&t=129423 to display some text with some features like underline, background color and font color for highlight purpose, how to do that?
-
- Posts: 4562
- Joined: 29 Mar 2015, 09:41
- Contact:
Re: ActiveX(HTML), how to underline a paragraph, change a sentence's background color and some words' font color
Code: Select all
#Requires AutoHotkey v2
DecoratedTextGui()
DecoratedTextGui() {
wnd := Gui()
document := wnd.AddActiveX('w220 h130', 'HTMLFILE').Value
document.Write('
(
<!DOCTYPE html>
<html>
<head>
<style>
* {
margin: 0;
padding: 0;
overflow: hidden;
}
.sometext {
position: absolute;
width: 100%;
height: 100%;
font-family: Calibri;
font-size: 14px;
overflow-y: scroll;
}
.underline {
text-decoration: underline;
}
.red-font-color {
color: red;
}
.yellow-back-color {
background-color: yellow;
}
</style>
</head>
<body>
<div class="sometext"></div>
</body>
<html>
)')
document.getElementsByClassName('sometext').0.innerHTML := '
( Join
<span class="underline">Lorem ipsum dolor sit amet,</span> consectetur adipiscing elit
, <span class="red-font-color">sed do eiusmod tempor incididunt ut labore et dolore magna a
liqua</span>. Ut enim ad minim veniam, <span class="yellow-back-color">quis nostrud exercitation</span> u
llamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in volupta
te velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sun
t in culpa qui officia deserunt mollit anim id est laborum.
)'
wnd.Show()
}
Re: ActiveX(HTML), how to underline a paragraph, change a sentence's background color and some words' font color
@teadrinker
Very happy to get your answer, I run your code but encounter a problem.
Error: This value of type "HTMLDocument" has no method named "getElementsByClassName".
007: document := wnd.AddActiveX('w220 h130', 'HTMLFILE').Value
008: document.Write('<!DOCTYPE html>
<html>
<head>
<style>
* {
margin: 0;
padding: 0;
overflow: hidden;
}
.sometext {
position: absolute;
width: 100%;
height: 100%;
font-family: Calibri;
font-size: 14px;
overflow-y: scroll;
}
.underline {
text-decoration: underline;
}
.red-font-color {
color: red;
}
.yellow-back-color {
background-color: yellow;
}
</style>
</head>
<body>
<div class="sometext"></div>
</body>
<html>')
▶ 043: document.getElementsByClassName('sometext').0.innerHTML := '<span class="underline">Lorem ipsum dolor sit amet,</span> consectetur adipiscing elit, <span class="red-font-color">sed do eiusmod tempor incididunt ut labore et dolore magna aliqua</span>. Ut enim ad minim veniam, <span class="yellow-back-color">quis nostrud exercitation</span> ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'
052: wnd.Show()
053: }
Very happy to get your answer, I run your code but encounter a problem.
Error: This value of type "HTMLDocument" has no method named "getElementsByClassName".
007: document := wnd.AddActiveX('w220 h130', 'HTMLFILE').Value
008: document.Write('<!DOCTYPE html>
<html>
<head>
<style>
* {
margin: 0;
padding: 0;
overflow: hidden;
}
.sometext {
position: absolute;
width: 100%;
height: 100%;
font-family: Calibri;
font-size: 14px;
overflow-y: scroll;
}
.underline {
text-decoration: underline;
}
.red-font-color {
color: red;
}
.yellow-back-color {
background-color: yellow;
}
</style>
</head>
<body>
<div class="sometext"></div>
</body>
<html>')
▶ 043: document.getElementsByClassName('sometext').0.innerHTML := '<span class="underline">Lorem ipsum dolor sit amet,</span> consectetur adipiscing elit, <span class="red-font-color">sed do eiusmod tempor incididunt ut labore et dolore magna aliqua</span>. Ut enim ad minim veniam, <span class="yellow-back-color">quis nostrud exercitation</span> ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'
052: wnd.Show()
053: }
-
- Posts: 4562
- Joined: 29 Mar 2015, 09:41
- Contact:
Re: ActiveX(HTML), how to underline a paragraph, change a sentence's background color and some words' font color Topic is solved
Try this fix:
Code: Select all
#Requires AutoHotkey v2
DecoratedTextGui()
DecoratedTextGui() {
FixIE()
wnd := Gui()
document := wnd.AddActiveX('w220 h130', 'HTMLFILE').Value
document.Write('
(
<!DOCTYPE html>
<html>
<head>
<style>
* {
margin: 0;
padding: 0;
overflow: hidden;
}
.sometext {
position: absolute;
width: 100%;
height: 100%;
font-family: Calibri;
font-size: 14px;
overflow-y: scroll;
}
.underline {
text-decoration: underline;
}
.red-font-color {
color: red;
}
.yellow-back-color {
background-color: yellow;
}
</style>
</head>
<body>
<div class="sometext"></div>
</body>
<html>
)')
document.getElementsByClassName('sometext').0.innerHTML := '
( Join
<span class="underline">Lorem ipsum dolor sit amet,</span> consectetur adipiscing elit
, <span class="red-font-color">sed do eiusmod tempor incididunt ut labore et dolore magna a
liqua</span>. Ut enim ad minim veniam, <span class="yellow-back-color">quis nostrud exercitation</span> u
llamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in volupta
te velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sun
t in culpa qui officia deserunt mollit anim id est laborum.
)'
wnd.Show()
}
FixIE() {
static regKey := 'HKCU\Software\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION'
SplitPath A_IsCompiled ? A_ScriptFullPath : A_AhkPath, &exeName
if RegRead(regKey, exeName, '') != '11000' {
RegWrite '11000', 'REG_DWORD', regKey, exeName
}
}
Re: ActiveX(HTML), how to underline a paragraph, change a sentence's background color and some words' font color
Thank you so much, I really appreciate all of your help.teadrinker wrote: ↑01 May 2024, 18:52Try this fix:Code: Select all
#Requires AutoHotkey v2 DecoratedTextGui() DecoratedTextGui() { FixIE() wnd := Gui() document := wnd.AddActiveX('w220 h130', 'HTMLFILE').Value document.Write(' ( <!DOCTYPE html> <html> <head> <style> * { margin: 0; padding: 0; overflow: hidden; } .sometext { position: absolute; width: 100%; height: 100%; font-family: Calibri; font-size: 14px; overflow-y: scroll; } .underline { text-decoration: underline; } .red-font-color { color: red; } .yellow-back-color { background-color: yellow; } </style> </head> <body> <div class="sometext"></div> </body> <html> )') document.getElementsByClassName('sometext').0.innerHTML := ' ( Join <span class="underline">Lorem ipsum dolor sit amet,</span> consectetur adipiscing elit , <span class="red-font-color">sed do eiusmod tempor incididunt ut labore et dolore magna a liqua</span>. Ut enim ad minim veniam, <span class="yellow-back-color">quis nostrud exercitation</span> u llamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in volupta te velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sun t in culpa qui officia deserunt mollit anim id est laborum. )' wnd.Show() } FixIE() { static regKey := 'HKCU\Software\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION' SplitPath A_IsCompiled ? A_ScriptFullPath : A_AhkPath, &exeName if RegRead(regKey, exeName, '') != '11000' { RegWrite '11000', 'REG_DWORD', regKey, exeName } }
Who is online
Users browsing this forum: DavidP, Google [Bot] and 81 guests