bsharath
asked on
Hta code with dropdown menu's for software installation.
Hi,
Hta code with dropdown menu's for software installation.
The below code is from Rob.
It works perfect. But for a specific senario i dont want the "Offices" drop down.
and
When a software is selected i want a small description given to the right of the in some free space describing of the application and if its a silent installor not.
Regards
Sharath
Hta code with dropdown menu's for software installation.
The below code is from Rob.
It works perfect. But for a specific senario i dont want the "Offices" drop down.
and
When a software is selected i want a small description given to the right of the in some free space describing of the application and if its a silent installor not.
Regards
Sharath
'=============
<head>
<title>Choose Software To Install</title>
<HTA:APPLICATION
APPLICATIONNAME="Choose Software To Install"
BORDER="thin"
SCROLL="no"
SINGLEINSTANCE="yes"
WINDOWSTATE="normal"
>
</head>
<script language="VBScript">
Dim arrSoftware
Sub Window_onLoad
intWidth = 800
intHeight = 600
Me.ResizeTo intWidth, intHeight
Me.MoveTo ((Screen.Width / 2) - (intWidth / 2)),((Screen.Height / 2) - (intHeight / 2))
arrSoftware = Array(_
"Chennai;Office Products;Office 2003;\\in\FS\Office_Products\Office_2003\SETUP.EXE", _
"Chennai;Office Products;Office Xp;\\dev\Office XP\SETUPPRO.EXE", _
"Chennai;Utilities;WinZip;\\dev\WinZip\SETUP.EXE", _
"Chennai;Utilities;Adobe Reader 7;\\ntfp\software\Adobe Reader\AdobeRdr709_Extracted\Adobe Reader 7.0.9.msi", _
"Chennai;Utilities;Windows Installer 3;\\ntfp\software\Windows Installer 3.1\WindowsInstaller-KB893803-v2-x86.exe", _
"Hyderabad;Messengers;Windows Messenger;\\server\share\WinMessenger\setup.exe", _
"Hyderabad;Utilities;Security Test;\\server\share\temp\PS4LICENSE\setup.exe", _
"Hyderabad;Databases;SQL Server Tools;\\server\share\SQL Server\Tools\setup.exe")
Populate_Office
End Sub
Sub Populate_Office
strHTML = "<select size='1' name='cbo_office' onchange='vbs:Populate_SoftwareType'>" & VbCrLf
strHTML = strHTML & "<option selected value='cbo_office'> --- Select Office --- </option>" & vbCrLf
strOffices = ";"
For Each strProduct In arrSoftware
strOffice = Split(strProduct, ";")(0)
If InStr(LCase(strOffices), LCase(";" & strOffice & ";")) = 0 Then
strOffices = strOffices & strOffice & ";"
strHTML = strHTML & "<option value='" & strOffice & "'>" & strOffice & "</option>" & VbCrLf
End If
Next
strHTML = strHTML & "</select>"
span_office.InnerHTML = strHTML
End Sub
Sub Populate_SoftwareType
strHTML = "<select size='1' name='cbo_softwaretype' onchange='vbs:Populate_Application'>" & VbCrLf
strHTML = strHTML & "<option selected value='cbo_softwaretype'> --- Select Software Type --- </option>" & VbCrLf
strTypes = ";"
For Each strProduct In arrSoftware
If LCase(Split(strProduct, ";")(0)) = LCase(cbo_office.Value) Then
strType = Split(strProduct, ";")(1)
If InStr(LCase(strTypes), LCase(";" & strType & ";")) = 0 Then
strTypes = strTypes & strType & ";"
strHTML = strHTML & "<option value='" & strType & "'>" & strType & "</option>" & VbCrLf
End If
End If
Next
strHTML = strHTML & "</select>"
span_softwaretype.InnerHTML = strHTML
End Sub
Sub Populate_Application
strHTML = "<select size='1' name='cbo_application'>" & VbCrLf
strHTML = strHTML & "<option selected value='cbo_application'> --- Select Application --- </option>" & VbCrLf
For Each strProduct In arrSoftware
If LCase(Split(strProduct, ";")(0)) = LCase(cbo_office.Value) And LCase(Split(strProduct, ";")(1)) = LCase(cbo_softwaretype.Value) Then
strApplication = Split(strProduct, ";")(2)
strFilePath = Split(strProduct, ";")(3)
strHTML = strHTML & "<option value='" & strApplication & ";" & strFilePath & "'>" & strApplication & "</option>" & VbCrLf
End If
Next
strHTML = strHTML & "</select>"
span_application.InnerHTML = strHTML
End Sub
Sub Default_Buttons
If Window.Event.KeyCode = 13 Then
btn_install.Click
End If
End Sub
Sub Install_Software
strLogFile = "\\indiasophos\Ps\HTA_Install_Log.csv"
Const intForAppending = 8
If cbo_office.Value = "cbo_office" Then
MsgBox "Please select an office."
cbo_office.Focus
ElseIf cbo_softwaretype.Value = "cbo_softwaretype" Then
MsgBox "Please select a software type."
cbo_softwaretype.Focus
ElseIf cbo_application.Value = "cbo_application" Then
MsgBox "Please select an application."
cbo_application.Focus
Else
strProduct = Split(cbo_application.Value, ";")(0)
strExecutable = Split(cbo_application.Value, ";")(1)
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")
Set objNetwork = CreateObject("WScript.Network")
'Software file,Machinename,Username,Date and time
strDetails = strExecutable & "," & objNetwork.ComputerName & "," & objNetwork.UserName & "," & Now
If objFSO.FileExists(strExecutable) = True Then
'objShell.Run strExecutable
If LCase(Right(strExecutable, 4)) = LCase(".msi") Then
strCommand = "msiexec /i " & objFSO.GetFile(strExecutable).ShortPath & " /qf /norestart"
Else
strCommand = "cmd /c """ & objFSO.GetFile(strExecutable).ShortPath & """"
End If
'MsgBox "Installing: " & strProduct & VbCrLf & "From:" & VbCrLf & strExecutable & VbCrLf & "With: " & strCommand
strExitCode = objShell.Run(strCommand, 1, True)
If Left(strCommand, 7) = "msiexec" And strExitCode = 1619 Then
MsgBox "You do not have permission to install this application." & VbCrLf & "Please contact the Help Desk."
ElseIf Left(strCommand, 6) = "cmd /c" And strExitCode = 1 Then
MsgBox "You do not have permission to install this application." & VbCrLf & "Please contact the Help Desk."
End If
Set objOutputFile = objFSO.OpenTextFile(strLogFile, intForAppending, True)
objOutputFile.WriteLine strDetails
objOutputFile.Close
Set objOutputFile = Nothing
Else
MsgBox "The file does not exist, or you do not have permission to access it." & VbCrLf & "Please contact the Help Desk."
End If
Set objShell = Nothing
Set objFSO = Nothing
Set objNetwork = Nothing
End If
End Sub
</script>
<body STYLE="font:14 pt arial; color:white;filter:progid:DXImageTransform.Microsoft.Gradient
(GradientType=1, StartColorStr='#000033', EndColorStr='#0000FF')" onkeypress='vbs:Default_Buttons'>
<table width='90%' height = '100%' align='center' border='0'>
<tr>
<td align="center" colspan="2">
<h2>Choose Software To Install</h2>
</td>
</tr>
<tr>
<td align='center'>
Choose from the options in each list:
</td>
</tr>
<tr>
<td>
Office:
<span id="span_office">
<select size="1" name="cbo_office">
<option selected value="cbo_office"> --- Select Office --- </option>
</select>
</span>
</td>
</tr
<tr>
<td>
Software Type:
<span id="span_softwaretype">
<select size="1" name="cbo_softwaretype">
<option selected value="cbo_softwaretype"> --- Select Software Type --- </option>
</select>
</span>
</td>
</tr
<tr>
<td>
Application:
<span id="span_application">
<select size="1" name="cbo_application">
<option selected value="cbo_application"> --- Select Application --- </option>
</select>
</span>
</td>
</tr
<tr>
<td align='center' colspan="2">
<input type="button" value="Install" name="btn_install" onClick="vbs:Install_Software"><br><br>
</td>
</tr>
<tr height='20%'>
<td>
</td>
</tr>
</table>
</body>
'=============
ASKER
Thanks Joe
All fine
I guess an additional option not to right click on the Hta
Can You please set the log to capture the Open time of Hta Installed application,Machine name,username and close time of Hta
All fine
I guess an additional option not to right click on the Hta
Can You please set the log to capture the Open time of Hta Installed application,Machine name,username and close time of Hta
so instead of this:
zzzz.exe,Computer123,User1 23,<app install start time>
yyyy.exe,Computer123,User1 23,<app install start time>
you want this?
<hta open time>,Computer123,User123, <hta close time>
OR this?
zzzz.exe,Computer123,User1 23,<app install start time>
yyyy.exe,Computer123,User1 23,<app install start time>
<hta open time>,Computer123,User123, <hta close time>
zzzz.exe,Computer123,User1
yyyy.exe,Computer123,User1
you want this?
<hta open time>,Computer123,User123,
OR this?
zzzz.exe,Computer123,User1
yyyy.exe,Computer123,User1
<hta open time>,Computer123,User123,
ASKER
I want this
zzzz.exe,Computer123,User1 23,<app install start time>,Hta close time,Date,timeofinstallati on
zzzz.exe,Computer123,User1
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Colum D,E,F has the same date and time
Can the change made in this post be done for this as well
https://www.experts-exchange.com/questions/26240521/Hta-file-that-can-install-softwares-Dont-want-the-cmd-window-to-open.html?cid=1575&anchorAnswerId=32933898#a32933898
Can the change made in this post be done for this as well
https://www.experts-exchange.com/questions/26240521/Hta-file-that-can-install-softwares-Dont-want-the-cmd-window-to-open.html?cid=1575&anchorAnswerId=32933898#a32933898
What if you open it in notepad?
ASKER
Got it time works fine.
can you give me the exact change i need to do from the other post into this
can you give me the exact change i need to do from the other post into this
It's already done ;)
ASKER
Thanks a lot Joe.
have postes a related Q please have a look...
https://www.experts-exchange.com/questions/26244944/HTA-script-need-help-with-an-addition.html
have postes a related Q please have a look...
https://www.experts-exchange.com/questions/26244944/HTA-script-need-help-with-an-addition.html
Open in new window