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

200 lines
6.3 KiB
HTML

<!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!")
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!")
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 searchFunc(searcher)
' Setting up a slew of variables and objects
strFileNameRaw = "C:\rawlist.txt"
strFileName = "C:\list.txt"
outFile = "C:\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
' Setting up raw list from chocolatey search
commandSearch = "cmd.exe /c chocolatey list " & searcher & " > C:\rawlist.txt"
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 "" & 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
parent.ifrme.Location.Reload(True)
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="submit" 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>
</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">
</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>