Last active
July 20, 2024 14:36
-
-
Save simply-coded/27f152beea39093a233dfe18ef4629ec to your computer and use it in GitHub Desktop.
Get available Component Object Models (COM)s on your computer, and view their members.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<!-- | |
Authors: Jeremy England | |
Company: SimplyCoded | |
Revised: 10/31/2016 | |
Description: | |
Gets a list of available COM objects on your computer. | |
Once populated, clicking on the COM name shows its members, as well as if it is vbscript compatible. | |
--> | |
<html> | |
<head> | |
<title>Available COM Objects</title> | |
<meta http-equiv="x-ua-compatible" content="IE=09"> | |
<hta:application | |
icon = "powershell.exe" | |
innerBorder="no" | |
singleInstance="yes" | |
/> | |
<!-- STYLE --> | |
<style> | |
html, | |
body { | |
margin: 0; | |
padding: 0; | |
height: 100%; | |
width: 100%; | |
font-family: consolas; | |
} | |
header { | |
background-color: #004C70; | |
box-sizing: border-box; | |
position: absolute; | |
top: 0; left: 0; | |
height: 45px; | |
width: 100%; | |
color: white; | |
font-size: 16pt; | |
z-index: 2; | |
} | |
header span { | |
margin-left: 400px; | |
} | |
aside { | |
background-color: #006495; | |
box-sizing: border-box; | |
position: absolute; | |
top: 0; left: 0; | |
height: 100%; | |
width: 450px; | |
padding-top: 45px; | |
overflow-y: scroll; | |
color: white; | |
z-index: 1; | |
} | |
main { | |
background-color: #FFFFFF; | |
box-sizing: border-box; | |
padding-top: 75px; | |
padding-left: 500px; | |
position: absolute; | |
left: 0; top: 0; | |
height: 100%; | |
width: 100%; | |
overflow: auto; | |
color: black; | |
z-index: 0; | |
} | |
a { | |
display: block; | |
padding: 10px; | |
cursor: pointer; | |
} | |
a:hover { | |
color: black; | |
font-weight: bold; | |
} | |
</style> | |
<!-- SCRIPT --> | |
<script type="text/vbscript"> | |
Sub window_onload() | |
Call getObjects() | |
End Sub | |
Function getObjects() | |
Dim result, comList | |
result = wps_out("gci HKLM:\Software\Classes -ea 0| ? {$_.PSChildName -match '^\w+\.\w+$' -and (gp ""$($_.PSPath)\CLSID"" -ea 0)} | ft PSChildName") | |
comList = Split(result, vbLf) | |
Dim names | |
Set names = document.getElementById("objNames") | |
Dim check : Set check = CreateObject("VBScript.RegExp") | |
check.Pattern = "^\w+\.\w+$" | |
Dim i, links | |
For i = 3 To UBound(comList) - 1 | |
If check.Test(comList(i)) Then | |
links = links & "<a onclick=""getMembers(this)"">" & comList(i) & "</a><br />" | |
End If | |
Next | |
names.innerHTML = links | |
End Function | |
Function getMembers(this) | |
Dim result | |
result = wps_out("New-Object -ComObject " & Trim(this.innerText) & " | Get-Member") | |
Dim details | |
Set details = document.getElementById("objDetails") | |
details.innerText = result & "VBScript Compatible: " & isCompatible(Trim(this.innerText)) | |
End Function | |
Function isCompatible(strTest) | |
On Error Resume Next | |
Dim testObj | |
Set testObj = CreateObject("" & strTest & "") | |
If Err.Number = 0 Then | |
isCompatible = True | |
Else | |
isCompatible = False | |
End If | |
End Function | |
Function wps_out(strCommand) | |
Dim wsh : Set wsh = CreateObject("WScript.Shell") | |
Dim wps, ignore, keep, return | |
set wps = wsh.Exec("powershell.exe") | |
wps.StdIn.WriteLine strcommand | |
wps.StdIn.Close | |
Do While True | |
ignore = wps.StdOut.ReadLine | |
If InStr(ignore, strCommand) Then | |
Exit Do | |
End If | |
Loop | |
Do | |
keep = wps.StdOut.ReadLine | |
If wps.StdOut.AtEndOfStream Then | |
Exit Do | |
Else | |
return = return & Trim(keep) & vbLf | |
End If | |
Loop | |
wps.StdOut.Close | |
wps_out = return | |
End Function | |
</script> | |
</head> | |
<!-- BODY --> | |
<body> | |
<header> | |
NAMES:<span>DETAILS:</span> | |
</header> | |
<aside id="objNames"> | |
<!-- vbs: populate COM list --> | |
</aside> | |
<main id="objDetails"> | |
<!-- vbs: populate COM members --> | |
</main> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment