Deprecated-Unsupported/HTA Projects/MAXIMUS-Installer/Src/SRC-MAXIMUSInstallerv1.15/MAXIMUS Installer.hta

285 lines
9.4 KiB
Plaintext
Raw Permalink Normal View History

2021-02-18 23:45:52 +00:00
<!doctype html>
<head>
<title>MAXIMUS Installer</title>
<link rel="stylesheet" type="text/css" href="./resources/other/css.css">
<HTA:APPLICATION
ID="MAXIMUS Installer"
VERSION="1.0"
APPLICATIONNAME="MAXIMUS Installer"
icon = "./resources/other/favicon.ico"
SCROLL="yes"
WINDOWSTATE="normal"
border = "thin"
caption = "yes"
maximizeButton = "no"
minimizeButton = "yes"
showInTaskbar = "yes"
version = "1.0"
/>
<script language="VBScript">
Window.ReSizeTo 1050, 640
Set objCall = CreateObject("WScript.Shell")
Function installChoco
Set objfsoChk = CreateObject("Scripting.FileSystemObject")
path="C:\ProgramData\chocolatey\"
exists = objfsoChk.FolderExists(path)
if (exists) then
MsgBox("Chocolatey Is Already Installed!")
Set objfsoChk = Nothing
Else
objCall.Run "cmd.exe /k @powershell -NoProfile -ExecutionPolicy unrestricted -Command ""iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))"" && SET PATH=%PATH%;%systemdrive%\chocolatey\bin", 1, True
MsgBox("Chocolatey Has Been Installed!")
Set objfsoChk = Nothing
end if
End Function
Sub callFaves
objCall.Run ".\resources\bin\popular.hta", 1, True
End Sub
Sub aboutMAXIMUS
objCall.Run ".\resources\bin\maximusAbout.hta", 1, True
End Sub
Sub aboutChoco
objCall.Run ".\resources\bin\chocoAbout.hta", 1, True
End Sub
Function installedFunc()
linker = "resources/bin/loading.html"
document.getElementById("ifrme2").src = linker
' Setting up a slew of variables and objects
Set objFSOW = CreateObject("Scripting.FileSystemObject")
preOut = objCall.ExpandEnvironmentStrings("%temp%") & "\preDldLst.txt"
outFile = objCall.ExpandEnvironmentStrings("%temp%") & "\installedList.html"
Set write = objFSOW.CreateTextFile(preOut,True)
write.Write ""
Set write = objFSOW.CreateTextFile(outFile,True)
write.Write ""
Set objFSOR = CreateObject("Scripting.FileSystemObject")
Set read = objFSOR.OpenTextFile(preOut)
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objTS = objFS.OpenTextFile(preOut, ForReading)
Const ForReading = 1
Const ForWriting = 2
' End of variables and objects declaration
parent.ifrme.Location.Reload(True)
' Setting up raw list from chocolatey list -lo
commandSearch = "cmd.exe /c clist -lo > " & preOut
objCall.Run commandSearch, 0, True
strContents = objTS.ReadAll
objTS.Close
write.Write "<!DOCTYPE HTML>" & vbCrLf &_
"<head>" & vbCrLf &_
"<style>" & vbCrLf &_
".bttnStyle {" & vbCrLf &_
"width: 100%;" & vbCrLf &_
"height: 2em;" & vbCrLf &_
"}" & vbCrLf &_
"</style>" & vbCrLf
write.Write "<script language=""vbscript"">" & vbCrLf &_
"Function cmdBtn_Click()" & vbCrLf &_
"target = window.event.srcElement.Value" & vbCrLf &_
"reply = MsgBox(""Do you wish to uninstall ""& target, vbYesNo)" & vbCrLf &_
"Select Case reply" & vbCrLf &_
"Case vbYes" & vbCrLf &_
"Set objShell = CreateObject(""WScript.Shell"")" & vbCrLf &_
"objShell.Run ""cmd.exe /k cuninst -y "" & target, 1, True" & vbCrLf &_
"Case vbNo" & vbCrLf &_
"End Select" & vbCrLf &_
"End Function" & vbCrLf &_
"</" &_
"script" &_
">" &_
"</head>" & vbCrLf &_
"<body style=""background:#222222;"">" & vbCrLf
Do Until read.AtEndOfStream
strLine= read.ReadLine
write.Write "<input style=""width:100%;"" type=""button"" name=""cmdBtn"" value=""" & strLine & """ onclick=""vbscript:cmdBtn_Click""><br>" & vbCrLf
Loop
write.Write "</body>" & vbCrLf &_
"</html>"
write.Close
document.getElementById("ifrme2").src = outFile
parent.ifrme2.Location.Reload(True)
'cleanup'
Set linker = Nothing
Set preOut = Nothing
Set outFile = Nothing
Set objFSOW = Nothing
Set objFSOR = Nothing
Set write = Nothing
End Function
Function searchFunc(searcher)
strLink = "resources/bin/loading.html"
document.getElementById("ifrme").src = strLink
' Setting up a slew of variables and objects
strFileNameRaw = objCall.ExpandEnvironmentStrings("%temp%") & "\rawlist.txt"
strFileName = objCall.ExpandEnvironmentStrings("%temp%") & "\list.txt"
outFile = objCall.ExpandEnvironmentStrings("%temp%") & "\dlList.html"
Set objFSOW = CreateObject("Scripting.FileSystemObject")
Set objFSOR = CreateObject("Scripting.FileSystemObject")
Set write = objFSOW.CreateTextFile(strFileNameRaw,True)
write.Write ""
Set write = objFSOW.CreateTextFile(strFileName,True)
write.Write ""
Set write = objFSOW.CreateTextFile(outFile,True)
Set read = objFSOR.OpenTextFile(strFileName)
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objTS = objFS.OpenTextFile(strFileNameRaw, ForReading)
Const ForReading = 1
Const ForWriting = 2
chkString = "Chocolatey"
chkString1 = "found."
' End of variables and objects declaration
parent.ifrme.Location.Reload(True)
' Setting up raw list from chocolatey search
commandSearch = "cmd.exe /c chocolatey list " & searcher & " > " & strFileNameRaw
objCall.Run commandSearch, 0, True
strContents = objTS.ReadAll
objTS.Close
arrLines = Split(strContents, vbNewLine)
Set objTS = objFS.OpenTextFile(strFileName, ForWriting)
For Each strLine In arrLines
If Not(Left((LTrim(strLine)),Len(chkString)) = chkString) AND Not(Right((RTrim(strLine)),Len(chkString1)) = chkString1) Then
objTS.WriteLine strLine
End If
Next
write.Write "<!DOCTYPE HTML>" & vbCrLf &_
"<head>" & vbCrLf &_
"<style>" & vbCrLf &_
".bttnStyle {" & vbCrLf &_
"width: 100%;" & vbCrLf &_
"height: 2em;" & vbCrLf &_
"}" & vbCrLf &_
"</style>" & vbCrLf
write.Write "<script language=""vbscript"">" & vbCrLf &_
"Function cmdBtn_Click()" & vbCrLf &_
"target = window.event.srcElement.Value" & vbCrLf &_
"reply = MsgBox(""Do you wish to install ""& target, vbYesNo)" & vbCrLf &_
"Select Case reply" & vbCrLf &_
"Case vbYes" & vbCrLf &_
"Set objShell = CreateObject(""WScript.Shell"")" & vbCrLf &_
"objShell.Run ""cmd.exe /k cinst -y "" & target, 1, True" & vbCrLf &_
"Case vbNo" & vbCrLf &_
"End Select" & vbCrLf &_
"End Function" & vbCrLf &_
"</" &_
"script" &_
">" &_
"</head>" & vbCrLf &_
"<body style=""background:#222222;"">" & vbCrLf
Do Until read.AtEndOfStream
strLine= read.ReadLine
write.Write "<input style=""width:100%;"" type=""button"" name=""cmdBtn"" value=""" & strLine & """ onclick=""vbscript:cmdBtn_Click""><br>" & vbCrLf
Loop
write.Write "</body>" & vbCrLf &_
"</html>"
write.Close
document.getElementById("ifrme").src = outFile
parent.ifrme.Location.Reload(True)
'cleanup'
Set strFileNameRaw = Nothing
Set strFileName = Nothing
Set outFile = Nothing
Set strLink = Nothing
Set outFile = Nothing
Set objFSOW = Nothing
Set objFSOR = Nothing
Set write = Nothing
Set fso = Nothing
End Function
Function preSearchFunc(searcher)
checker = InStr(searcher,"cinst") OR InStr(searcher,"choco") OR InStr(searcher,"chocolatey")
If ( checker = 0 ) Then
searchFunc(searcher)
Else
inputVal = "cmd.exe /k " & searcher
objCall.Run inputVal, 1, True
End If
End Function
</script>
</head>
<body>
<div class="divStyleHeader">
<a href="./resources/bin/popular.html" target="ifrme">
<img src="resources\menuIcons\star.png" style="float:left;clear:right;"></img>
<p class="populr"><font size="5">Popular</font><p>
</a>
<div>
<p class="bttn" onclick="installChoco"><font size="5">Install Chocolatey NuGet!</font></p>
<a href="C:/dlList.html" style="clear:both;float:right;"target="ifrme">Search List</a>
</div>
<script language="vbscript">
Function formSubmt
searcher = document.getElementById("query").value
preSearchFunc(searcher)
End Function
</script>
<form style="float:right;">
<input name="query" type="text" >
<input type="button" value="Search/Run" onclick="formSubmt">
</form>
</div>
<div class="divStyleLeftColumn">
<div>
<script language="vbscript">
Function mediaFunc
searcher = "media"
preSearchFunc(searcher)
End Function
</script>
<img class="image" src="resources\menuIcons\media.png" onclick="mediaFunc"></img>
<br><br>&nbsp;&nbsp; Media
</div>
<div>
<script language="vbscript">
Function officeFunc
searcher = "office"
preSearchFunc(searcher)
End Function
</script>
<img class="image" src="resources\menuIcons\office.png" onclick="officeFunc"></img>
<br><br>&nbsp;&nbsp; Office
</div>
<div>
<script language="vbscript">
Function webFunc
searcher = "web"
preSearchFunc(searcher)
End Function
</script>
<img class="image" src="resources\menuIcons\web.png" onclick="webFunc"></img>
<br><br>&nbsp;&nbsp; Web
</div>
<div>
<script language="vbscript">
Function securityFunc
searcher = "security"
preSearchFunc(searcher)
End Function
</script>
<img class="image" src="resources\menuIcons\security.png" onclick="securityFunc"></img>
<br><br>&nbsp;&nbsp; Secirity
</div>
<form style="float:left;margin-left:15%;">
<input type="button" value="Installed Software" onclick="installedFunc">
</form>
</div>
<div class="divStyleRightTopFrame">
<iframe id="ifrme" name="ifrme" src="resources/bin/popular.html" style="height:18em;width:100%;" application="yes"></iframe>
</div>
<div class="divStyleRightBottomFrame">
<iframe id="ifrme2" name="ifrme" src="#" style="height:10em;width:100%;" application="yes"></iframe>
</div>
<div class="BottomFrame">
<div style="margin-left:20%;">
<p class="bttnBTTM" onclick="aboutMAXIMUS"><font size="5">About MAXIMUS</font></p>
<p class="bttnBTTM" onclick="aboutChoco"><font size="5">About Chocolatey NuGet</font></p>
</div>
</div>
</body>
</html>