Encode .ico in HTML Application (.hta) File - html

UPDATE: I changed the image displaying on my page to an encoded version, instead of referencing the external image. I was able to put my image into a Base64 converter, and then copy and paste the string version of the image into the file (represented by ~~~ in my code below). This worked fine. Is there a similar method for encoding the icon?
Problem: I have a HTML Application file (.hta) that I've created. To make the user experience more customized I would like to change the icon for the taskbar (and maybe the actual file when looking at it in the file explorer or on SharePoint). The reason I want to encode the image instead of using a file is because when I try to use a network file, it takes a 'long' time to open the .hta file and I know this will annoy my end users. It is a basic site with links to open template files that we use frequently, the purpose is to open a copy of the most recent template so we make sure everyone is using the most current templates and knows where all of the tools we use are located. I've researched this quite a bit and I can't seem to find a solution that works for me.
What I've Tried:
I've tried the "trick" where I use the Command Prompt to copy the .ico file to the .hta file. This does change the icon but displays a bunch of nonsensical text at the top of my page above all of my content. If someone has a solution for removing this, that works. Unless this is not a stable solution...
I've also tried converting my image to Base64 and using that when declaring the ICON in < HTA:APPLICATION ... />, similar to encoding for < img >, but it didn't work for me. When I tried, nothing happened.
Additional Comments: I'm OK with any solution really, as long as the image is encoded and it is stable.
Basic Structure of Working File (UPDATED):
<!DOCTYPE html>
<html>
<HTA:APPLICATION ID = "oMyApp" APPLICATIONNAME = "MyApp" ICON = "path" BORDER = "thick" CAPTION = "yes" SHOWINTASKBAR = "yes" SINGLEINSTANCE = "yes" SYSMENU = "yes" WINDOWSTATE = "maximize" />
<head>
<title> My App </title>
<link rel = "icon" href = "path">
<link rel = "sytlesheet" type = "text/css" href = "StyleSheet.css">
</head>
<body> <div class = "content">
<div class = "Title">
<img src = "data:image/png;base64,~~~" alt = "icon" />
<strong> My App </strong>
</div>
<div class = "main">
<div class = "column">
<div class = "box">
File Name <br>
<strong> Instructions </strong> <br>
<em> Description of File </em>
</div>
<div class = "box">
File Name <br>
<strong> Instructions </strong> <br>
<em> Description of File </em>
</div>
<div class = "box">
File Name <br>
<strong> Instructions </strong> <br>
<em> Description of File </em>
</div>
<br><br>
</div>
<div class = "column">
<div class = "box">
File Name <br>
<strong> Instructions </strong> <br>
<em> Description of File </em>
</div>
<div class = "box">
File Name <br>
<strong> Instructions </strong> <br>
<em> Description of File </em>
</div>
<div class = "box">
File Name <br>
<strong> Instructions </strong> <br>
<em> Description of File </em>
</div>
<br><br>
</div>
<div class = "column">
<div class = "box">
File Name <br>
<strong> Instructions </strong> <br>
<em> Description of File </em>
</div>
<div class = "box">
File Name <br>
<strong> Instructions </strong> <br>
<em> Description of File </em>
</div>
<div class = "box">
File Name <br>
<strong> Instructions </strong> <br>
<em> Description of File </em>
</div>
<br><br>
</div>
<div class = "column">
<div class = "box">
File Name <br>
<strong> Instructions </strong> <br>
<em> Description of File </em>
</div>
<div class = "box">
File Name <br>
<strong> Instructions </strong> <br>
<em> Description of File </em>
</div>
<div class = "box">
File Name <br>
<strong> Instructions </strong> <br>
<em> Description of File </em>
</div>
<br><br>
</div>
</div>
<div class = "Footer">
<em> Comment to Users </em>
</div>
</div> </body>
</html>
Please Help

Related

Embed image into outlook email

I want to embed images saved in local directory into an outlook email. Have defined a function to do that and also added the html according. However, the image doesn't come up. Not an issue with the file path as I've already checked that it's working. What did I do wrong?
def Emailer(text, subject, recipient, cc):
import win32com.client as win32
import os
outlook = win32.Dispatch('outlook.application')
mail = outlook.CreateItem(0)
mail.To = recipient
mail.CC = cc
mail.Subject = subject
mail.HtmlBody = text
mail.Display(True)
MailSubject = "Daily Report for " + date_slash
MailInput ="""
<div>
<img src={}></img>
</div>
<div>
<p>
</div>
<div>
<img src={}></img>
</div>
<div>
<p>
</div>
<div>
<img src={}></img>
</div>
<div>
<p>
</div>
<div>
<img src={}></img>
</div>
<div>
<p>
</div>
<div>
<img src={}></img>
</div>
"""
MailInput = MailInput.format(date_slash, sum_path, ovdv_path, cot_path, rub_path ,pnl_path)
MailRecipient ="xxx#yyy.com;"
MailCc = "xxx#yyy.com;"
A remote recipient cannot obviously see files from your machine.
You need to add images as attachments (Attachment = MailItem.Attachments.Add) and set the PR_ATTACH_CONTENT_ID MAPI property to the value used in the <img> tag (e.g., <img src='cid:MyTestId'>) using Attachment.PropertyAccessor.SetProperty:
Attachment.PropertyAccessor.SetProperty("http://schemas.microsoft.com/mapi/proptag/0x3712001E", "MyTestId")

Angular *ngFor problems on showing result

i'm trying to show tags from user, (example when user write #name).
my code in html is this.
<div *ngIf="tagsArr" style="display: flex;">
<p>
<span>Tags: </span>
</p>
<p *ngFor="let tag of tagsArr">
<span> {{tag}}, </span>
</p>
</div>
This is the code. and the result is like:
Tags: #name ,#name ,#name < / p >,
(without space)
Why the end tag of </p>, is displayed there?
I want to display the Tags like:
Tags: #name, #name, #name
it shouldn't show <p> may be you have a <p> string in tagsArr
it work fine on my device
.ts
tagsArr = ['#tag1, #tag2, #tag3' ,'#tag4' ]
.html
<div *ngIf="tagsArr">
<p>
<span>Tags: </span>
</p>
<p *ngFor="let tag of tagsArr">
<span> {{tag}}, </span>
</p>
</div>

Dynamically Inject new HTML into a web page and be able to access any new DOM elements that are in the "new" injected HTML

I found this link that suggested injecting a table into a div.
enter link description here
Here is an example of new HTML that I want to inject:
<br />
<br />
<LSz class='LineSpaceDouble'>
Hi, <p class='FIRST_NAME'> </p> <br><br>
Hi <p class='FIRST_NAME'> </p>, my name is <p class='MYNAME'> </p> .
More Text.<br>
</LSz>
<br />
<label for='PBirthDate'>Primary Birthdate:</label>
<input id='PBirthDate' class='input100' type='text' name='PBirthDate' placeholder='mm/dd/yr' size='10'>
<span class='focus-input100'></span>
<br />
Here is my current jq code that does the injection:
var S = J;
$(S).appendTo('#Script_Displayed');
J holds HTML text to be injected.
and Script_Displayed is the id of the div
THAT works -- in that the "text" is indeed injected into the web page where the div is located.
My problem is when I attempt to change a value:
var Z = document.getElementsByClassName('FIRST_NAME');
Z.innerHTML = "Anthony";
The new innerHTML value does not appear on the web page.
What Can I do to make these changes visible?
The function getElementsByClassName returns a collection of elements, not a single element. So this won't work by default:
Z.innerHTML = "Anthony";
Instead, loop over the collection to assign the innerHTML value to each element in the collection:
var Z = document.getElementsByClassName('FIRST_NAME');
for (let el of Z) {
el.innerHTML = "Anthony";
}
Hi, <p class='FIRST_NAME'> </p> <br><br>
Hi <p class='FIRST_NAME'> </p>, my name is <p class='MYNAME'> </p> .
More Text.<br>

How to scrape mailto from following page using VBA

i am trying to scrape mailto (href) from a html file, but i am unable to "hit" it.
Any advice is welcome.
<div class="exhibitor-contact">
<div class="col">
<h3>
whatever </h3>
<p>
MLW <br /> whatever<br /> 75008 Paris - France </p>
<p>
<a class='inverse-a-span' href='#tel' id='tel' onclick="return xt_click(this,'C', xtn2, xtpage.replace(/\w*$/, 'exhibitor::tel').replace(/^Exhibitors::/, ''), 'A')">Show Phone Number</a><span style='display:none;'>whatever</span><br /> Send an Email<br /> </p>
</div>
</div>
</section>
Code:
Set my_data = IE.Document.getElementsByClassName("anyclass")
Set mail = IE.Document.getElementsByTagName("a")(0) ActiveSheet.Cells(i, 2).Value = mail.href
Use a css attribute = value selector with ^ starts with operator
Debug.Print ie.document.querySelector("[href^='mailto:']").href

how to get all HTML elements with specific text by jsoup

How can I get all elements with specific text(inner HTML) in an HTML document by jsoup?
for example all elements with text test :
<html><head><title>for example></title></head>
<body>
<div id="div1" class='test'>
test
<p id='p1'>test<a id='a1'>test</a></p>
<a id='a2'>test</a>
<img src='' id='img1' alt='test'>
<p id='p2'>example</p>
</div>
</body></html>
note that I don't want to use tags' id or tags' name for selecting elements!
If I understand you correctly:
String html = "<html><head><title>for example></title></head><body><div id=\"div1\" class='test'>test<p id='p1'>test<a id='a1'>test</a></p><a id='a2'>test</a><img src='' id='img1' alt='test'><p id='p2'>example</p></div></body></html>";
Document doc = Jsoup.parse(html);
Elements elements = doc.select("*:containsOwn(test)");
for(Element element:elements)
{
System.out.println(element.toString()+"\n");
}
This will give the output for tags with id: div1,p1,a1,a2.