I'm programming a HTA where I can look up data on companies (company name, entity type etc.) from an external website, based on the company registration number.
Since I'm programming in a HTA I'm struggeling to find a solution that is supported. I have tried different scripts in JavaScript, jQuery and VBScript, but none seemed to work in the HTA (some worked in JSFiddle, but not in the HTA).
I have the following URL: https://datacvr.virk.dk/data/visenhed?enhedstype=virksomhed&id=24256790. (Note the 8 digit code which is the registration number).
I would like to have the following text:
Novo Nordisk A/S
Virksomhedsform: Aktieselskab
Hopefully someone knows how I can get the data which is requested.
Update #2: Below is my full HTA code:
<html>
<HTA:APPLICATION ID="Company Data" APPLICATIONNAME="Company Data" BORDER="thick" CAPTION="yes" ICON=images\icon.ico MAXIMIZEBUTTON="yes" MINIMIZEBUTTON="yes" SHOWINTASKBAR="yes" SINGLEINSTANCE="no" SYSMENU="yes" RESIZE="yes" contextMenu=no></HTA:APPLICATION>
<head>
<title>Regnskabskommetar</title>
<link href="include/stylesheet.css" rel="stylesheet" type="text/css" />
<link rel="SHORTCUT ICON" href="images/icon.ico"/>
<script type="text/javascript" charset="utf-8" src="include/jquery-1.7.min.js"></script>
<script type="text/javascript" charset="utf-8" src="include/underscore-min.js"></script>
<script type="text/javascript" charset="utf-8" src="include/autoNumeric-1.9.18.js"></script>
<script type="text/javascript" charset="utf-8" src="include/addFormat.js"></script>
<script>
function init()
{
var input = document.getElementById("cvr_nr").focus();
}
</script>
<script language="vbscript">
Set fso = CreateObject("Scripting.FileSystemObject")
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = false
ie.Navigate("https://datacvr.virk.dk/data/visenhed?enhedstype=virksomhed&id=24256790")
Dim dteWait
dteWait = DateAdd("s", 1, Now())
Do Until (Now() > dteWait)
Loop
Set Table = ie.document.getElementsByClassName("table stamdata")
For x = 0 to (Table.length)-1
Data = Data & Table(x).innerText
Next
ie.Quit()
MyFile = "DataLog.txt"
If fso.FileExists(MyFile) Then
fso.DeleteFile(MyFile)
End If
WriteTextFile Data, MyFile, -1
set ws = createObject("wscript.shell")
ws.run MyFile
Sub WriteTextFile(sContent, sPath, lFormat)
' lFormat -2 - System default, -1 - Unicode, 0 - ASCII
With CreateObject("Scripting.FileSystemObject").OpenTextFile(sPath, 8, True, lFormat)
.WriteLine sContent
.Close
End With
End Sub
</script>
<script type="text/javascript">
function reloadpage() {
location.reload();
}
</script>
<script language="vbscript">
resizeto (screen.width)/2,(screen.height - 40) // 40 is the height of task bar
moveto (screen.width)/2,0
</script>
</head>
<body onLoad="init()" language="vbscript">
<table width="100%" border="0" cellpadding="0" cellspacing="0" style='margin-bottom: 5px;' id="sticky_navigation">
<tr>
<td height="40" id="top_bar" style="padding-left: 10px;">Company Data</td>
<td height="40" id="top_bar" align="right"><a href="include/Help.pdf" class="help">Help</a></td>
<td width="10" id="top_bar" align="right" style="padding-right: 10px;"><a href="#" tabindex="-1" onClick="reloadpage()"><img src="images/footer-logo.png" border="0" title="Opdatér" /></a></td>
</tr>
</table>
<table border="0" width="98%" cellpadding="0" cellspacing="0" style="margin-left: 10 px">
<tr>
<td width="40%">
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td width="110">
<b>CVR.</b><br>
<input name="cvr_nr" id="cvr_nr" title="CVR - Kan angives med og uden 00 foran" onchange="" style="text-align: left" size="12" type="number" required></td>
</td>
<td valign="top">
<b >Virksomhedsnavn</b><br>
<input style="text-align: left" value="Novo Nordisk A/S" size="50"></input>
<td valign="top">
<b>Virksomhedsform</b><br>
<input style="text-align: left" value="Aktieselskab" size="22" disabled></input>
</tr>
</table>
<div id="include_facility" class="switchcontent1"></div>
<br>
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td style="padding-top:5px">
<hr>
<button id="Scraper" onclick="Scraper()" name="Scraper" tabindex="1">Get company</button>
<hr>
</td
</tr>
</table>
<br>
<div id="content1"></div>
</body>
</html>