Beta4Me Posted October 20, 2006 Share Posted October 20, 2006 (edited) This is an HTA. It has JavaScript and VBS in it too so i would conside it Programming.This is my code:<HTML><HEAD> <TITLE>Install Applications</TITLE> <HTA:APPLICATION applicationname="Install Applications" maximizebutton="no" minimizebutton="yes" scroll="no" showintaskbar="yes" singleinstance="yes" Icon="%SystemRoot%\explorer.exe"> <STYLE type="text/css"> Body { font:10.75pt; font-family: arial, Verdana, Palatino Linotype; color:#E3E3E3; filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0, StartColorStr='blue', EndColorStr='#000000'); padding-top:1; padding-bottom:1; Text-Align:; } .Button { font: 8.25pt; font-family: Verdana, Palatino Linotype; color:#E1E1E1; font-weight:bold; Text-Align:Center; filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0,StartColorStr='lightblue',endColorStr='darkblue'); padding-top:1; padding-bottom:1; cursor:Hand; Height:19; width:93; border-left: 1px Transparent; border-right: 2px Transparent; border-top: 1px Transparent; border-Bottom: 2px Transparent; } .TextBackGround { font-family: arial, Verdana, Palatino Linotype; color:#1E1E1E; font-weight:bold; filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0,StartColorStr=#e2ded8,EndColorStr=#e8e2de; padding-top:1; padding-bottom:1; border-left: 3px none Transparent; border-right: 2px none Transparent; border-top: 3px none Transparent; border-Bottom: 2px none Transparent; font-style:normal; font-variant:normal; font-size:8.25pt }</STYLE> <script Language="JavaScript"> var Act = new ActiveXObject("Wscript.Shell"); var Fso = new ActiveXObject("Scripting.FileSystemObject"); /* CLOSE THE HTA -> */ function ExitThis() { window.close();} /* RUN BUTTON CHANGE TEXT -> */ function Button1ChangeText() { if (Install_Button.value =="Install Apps") {Install_Button.value ='Click 2 Install'} else {Install_Button.value ='Install Apps';}} /* CLEAR BUTTON CHANGE TEXT -> */ function Button2ChangeText() { if (Clear_Button.value =="Clear Text") {Clear_Button.value ='Clear All Text'} else {Clear_Button.value ='Clear Text';}} /* CLOSE BUTTON CHANGE TEXT -> */ function Button3ChangeText() { if (Close_Button.value =="Exit") {Close_Button.value ='Close'} else {Close_Button.value ='Exit';}} </SCRIPT> <script language="VBScript"> Dim strAlcohol120, strDVDDecrypter, strDVDShrink, strWB51, strAdAware, strAVG, strCC, strZLS'/-> TEXT BOXES SCRIPTS Function Install() strAlcohol120 = TextBox0.Value : strDVDDecrypter = TextBox1.Value : strDVDShrink = TextBox2.Value : strWB51 = TextBox3.Value : strAdAware = TextBox4.Value : strAVG = TextBox5.Value : strCC = TextBox6.Value : strZLS = TextBox7.Value : strRunScript = RunScript If strAlcohol120 = "" Then window.alert "Alert" & vbcrlf & "You need to fill in " & chr(34) & "Alcohol 120%" & chr(34),64,"Alert" document.getElementByID("textbox0").select ElseIf strDVDDecrypter = "" Then window.alert "Alert" & vbcrlf & "You need to fill in " & chr(34) & "DVD Decrypter" & chr(34),64,"Alert" document.getElementByID("textbox1").select ElseIf strDVDShrink = "" Then window.alert "Alert" & vbcrlf & "You need to fill in " & chr(34) & "DVD Shrink" & chr(34),64,"Alert" document.getElementByID("textbox2").select ElseIf strWB51 = "" Then window.alert "Alert" & vbcrlf & "You need to fill in " & chr(34) & "WindowBlinds 5.1" & chr(34),64,"Alert" document.getElementByID("textbox3").select ElseIf strAdAware = "" Then window.alert "Alert" & vbcrlf & "You need to fill in " & chr(34) & "Ad-Aware" & chr(34),64,"Alert" document.getElementByID("textbox4").select ElseIf strAVG = "" Then window.alert "Alert" & vbcrlf & "You need to fill in " & chr(34) & "AVG Anti-virus" & chr(34),64,"Alert" document.getElementByID("textbox5").select ElseIf strCC = "" Then window.alert "Alert" & vbcrlf & "You need to fill in " & chr(34) & "Crap Cleaner" & chr(34),64,"Alert" document.getElementByID("textbox6").select ElseIf strZLS = "" Then window.alert "Alert" & vbcrlf & "You need to fill in " & chr(34) & "Zone Alarm" & chr(34),64,"Alert" document.getElementByID("textbox7").select End If Set strScript = Fso.CreateTextFile("Install.vbs") If strAlcohol120 = "Yes" Then Act.Run("%Comspec% /C Alcohol120.exe /c /add"), 0, True End If If strDVDDecrypter = "Yes" Then Act.Run("%Comspec% /C DVDDecrypter354.exe /c /add"), 0, True End If If strDVDShrink = "Yes" Then Act.Run("%Comspec% /C DVDShrink32.exe /c /add"), 0, True End If If strWB51 = "Yes" Then Act.Run("%Comspec% /C WB51.exe /c /add"), 0, True End If If strAdAware = "Yes" Then Act.Run("%Comspec% /C ADAWARE.EXE /c /add"), 0, True End If If strAVG = "Yes" Then Act.Run("%Comspec% /C AVG71.EXE /c /add"), 0, True End If If strCC = "Yes" Then Act.Run("%Comspec% /C CCLEANER.EXE /c /add"), 0, True End If If strZLS = "Yes" Then Act.Run("%Comspec% /C ZLS.exe /c /add"), 0, True End If'/-> FINISHING SCRIPT strScript.WriteLine "Fso.DeleteFile(WScript.ScriptFullName)" strScript.Close call RunScript End Function '/-> RUN NEW SCRIPT AND THEN DELETE THE SCRIPT Function RunScript() : Act.Run("Install.vbs"), 1, True : End Function'/-> CLEAR THE TEXT BOXES Function ClearText() : TextBox0.Value = "" : TextBox1.Value = "" : TextBox2.Value = "" : TextBox3.Value = "" : TextBox4.Value = "" : TextBox5.Value = "" : TextBox6.Value = "" : TextBox7.Value = "" : End Function'/-> ON LOAD EVENT Function window_Onload() : window.ResizeTo 470,380 : TextBox0.focus() : End Function </SCRIPT> </HEAD><BODY><CENTER><!-- TEXT BOX TABLE START --><TABLE width='95%' border='1' cellpadding='6'><TD><!-- TEXT BOX 00 START --> <TABLE><TD Width='125'><B>Alcohol 120%</TD><TD> :</B></TD> <TD colspan="2"><Input type="text" Class='TextBackGround' size="36" name="textbox0"> </TD></TABLE> <!-- TEXT BOX 01 START --> <TABLE><TD Width='125'><B>DVD Decrypter</TD><TD> :</B></TD> <TD colspan="2"><Input type="text" Class='TextBackGround' size="36" name="textbox1"> </TD></TABLE><!-- TEXT BOX 02 START --> <TABLE><TD Width='125'><B>DVD Shrink</TD><TD> :</B></TD> <TD colspan="2"><Input type="text" Class='TextBackGround' size="36" name="textbox2"> </TD> </TABLE><!-- TEXT BOX 03 START -- <TABLE id="table1"><TD Width='125'><B>WindowBlinds</TD><TD> :</B></TD> <TD colspan="2"><Input type="text" Class='TextBackGround' size="36" name="textbox3"> </TD></TABLE><!-- TEXT BOX 04 START --> <TABLE id="table6"><TD Width='125'><B>Ad-Aware</TD><TD> :</B></TD> <TD colspan="2"><Input type="text" Class='TextBackGround' size="36" name="textbox4"> </TD></TABLE><!-- TEXT BOX 05 START --> <TABLE id="table10"><TD Width='125'><B>AVG Anti-virus</TD><TD> :</B></TD> <TD colspan="2"><Input type="text" Class='TextBackGround' size="36" name="textbox5"> </TD></TABLE><!-- TEXT BOX 06 START --> <TABLE id="table13"><TD Width='125'><B>Crap Cleaner</TD><TD> :</B></TD> <TD colspan="2"><Input type="text" Class='TextBackGround' size="36" name="textbox6"> </TD></TABLE><!-- TEXT BOX 07 START --> <TABLE id="table14"><TD Width='125'><B>Zone Alarm</TD><TD> :</B></TD> <TD colspan="2"><Input type="text" Class='TextBackGround' size="36" name="textbox7"> </TD></TABLE><!-- TEXT BOX TABLE END --></TABLE><p style="margin-top: 0; margin-bottom: 0"> </p><!-- BUTTON TABLE START --><TABLE><!-- RUN BUTTON START --> <TD Width='125' Align='Center'><Input type="button" Class='Button' Value="Install Apps" name="Install_Button" OnMouseOver="Button1ChangeText(),this.style.color='#330000';" OnMouseOut="Button1ChangeText(),this.style.color='#E1E1E1';" onClick="Install()"></TD><!-- CLEAR BUTTON START --> <TD Width='125' Align='Center'><Input type="button" Class='Button' Value="Clear Text" name="Clear_Button" OnMouseOver="Button2ChangeText(),this.style.color='#330000';" OnMouseOut="Button2ChangeText(),this.style.color='#E1E1E1';" onClick="ClearText()"></TD> <!-- CLOSE BUTTON START --> <TD Width='125' Align='Center'><Input type="button" Class='Button' Value="Exit" name="Close_Button" OnMouseOver="Button3ChangeText(),this.style.color='#330000';" OnMouseOut="Button3ChangeText(),this.style.color='#E1E1E1';" onClick="ExitThis()"></TD> <!-- BUTTON TABLE END --> </TABLE></CENTER><!-- Yzöwl TABLE START --> <TABLE><TD WIDTH='236' HEIGHT='47' Style='font:8.75pt;Color:"white"'><SPAN ID='Txt1'></SPAN></TD> <TD><FONT color="#E1E1E1" size="1.25">© 2006 Yzöwl. All Rights Reserved</FONT></TD></TABLE><!-- Yzöwl TABLE END --> </BODY></HTML>Run it and you should see the error.Any suggestions in other aspects and/or neating/cleaning/tidying/fixing/more-effiecient-ing this script would also be much appreciated.TY guys. Edited October 20, 2006 by Beta4Me Link to comment Share on other sites More sharing options...
gunsmokingman Posted October 20, 2006 Share Posted October 20, 2006 (edited) There where to many errors for me to fix it. Plus to use text input boxes to type yes is not a good idea.I have change all those to checkboxes.You will have to uncomment all of this in the hta to make them active, then add the path to the application and it switches for the application.' If Fso.FileExists(PLACE THE PATH AND NAME HERE) Then ' Act.Run("PLACE THE PATH AND NAME AND SWITCHES HERE"), 0, True ' Else ' window.alert "Missing DVD Decrypter" ' End IfAll the window.alerts in the Install() Function can be removed. I only have them there to check that they are working.window.alert "Confirm Alcohol 120%"Here is the hta code<HTML><HEAD><TITLE>Install Applications</TITLE> <HTA:APPLICATION applicationname="Install Applications" maximizebutton="No" minimizebutton="No" scroll="no" showintaskbar="yes" singleinstance="yes" Icon="%SystemRoot%\explorer.exe"> <!-- ======================================================================================================== --> <!-- BODY BACK GROUND --> <STYLE type="text/css"> /* <!-- BODY BACK GROUND --> */ body { font:10.25pt; font-family: Verdana, Palatino Linotype, Ms Comic; color:#E3E3E3; font-weight:bold; Text-Align:Center; filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0,StartColorStr='#91c3e1',endColorStr='#1c3870'); } /* <!-- BUTTON BACK GROUND --> */ .Button { font: 8.25pt; font-family: Verdana, Palatino Linotype; color:#E1E1E1; font-weight:bold; Text-Align:Center; filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0,StartColorStr='lightblue',endColorStr='darkblue'); padding-top:1; padding-bottom:1; cursor:Hand; Height:19; width:103; border-left: 1px Transparent; border-right: 2px Transparent; border-top: 1px Transparent; border-Bottom: 2px Transparent; } /* <!-- TEXT FOR ANY CLASS --> */ .Text1 { font-size:8.75pt; font-family: Verdana, Palatino Linotype; font-weight:Bold; line-height:110%; color:#d5d5d5; Text-Align:; } </STYLE> <script Language="JavaScript"> /* <-- OBJECTS FOR THE SCRIPT --> */ var Act = new ActiveXObject("Wscript.Shell"); var Fso = new ActiveXObject("Scripting.FileSystemObject"); /* <-- THIS CHANGES THE TEXT AND IT COLOR --> */ var Msg1 = "<Font Color='#000080'> Check To Install</Font>"; /* <-- CHECKBOX 01 DISPLAY TEXT -> */ function ChangeText1() { if (Span1.innerHTML =="Alcohol 120%") { Span1.innerHTML = Msg1;} else {Span1.innerHTML ='Alcohol 120%';}} /* <-- CHECKBOX 02 DISPLAY TEXT --> */ function ChangeText2() { if (Span2.innerHTML =="DVD Decrypter") { Span2.innerHTML = Msg1;} else {Span2.innerHTML ='DVD Decrypter';}} /* <-- CHECKBOX 03 DISPLAY TEXT --> */ function ChangeText3() { if (Span3.innerHTML =="DVD Shrink") { Span3.innerHTML = Msg1;} else {Span3.innerHTML ='DVD Shrink';}} /* <-- CHECKBOX 04 DISPLAY TEXT --> */ function ChangeText4() { if (Span4.innerHTML =="Ad-Aware") { Span4.innerHTML = Msg1;} else {Span4.innerHTML ='Ad-Aware';}} /* <-- CHECKBOX 05 DISPLAY TEXT --> */ function ChangeText5() { if (Span5.innerHTML =="AVG Anti-Virus") { Span5.innerHTML = Msg1;} else {Span5.innerHTML ='AVG Anti-Virus';}} /* <-- CHECKBOX 06 DISPLAY TEXT --> */ function ChangeText6() { if (Span6.innerHTML =="Crap Cleaner") { Span6.innerHTML = Msg1;} else {Span6.innerHTML ='Crap Cleaner';}} /* <-- CHECKBOX 07 DISPLAY TEXT --> */ function ChangeText7() { if (Span7.innerHTML =="Zone Alarm") { Span7.innerHTML = Msg1;} else {Span7.innerHTML ='Zone Alarm';}} /* <-- CHECKBOX 08 DISPLAY TEXT --> */ function ChangeText8() { if (Span8.innerHTML =="Check Box 8") { Span8.innerHTML = Msg1;} else {Span8.innerHTML ='Check Box 8';}} /* <-- CLOSE THE HTA --> */ function ExitThis() { window.close();} /* <-- RUN BUTTON CHANGE TEXT --> */ function Button1ChangeText() { if (Install_Button.value =="Install Apps") {Install_Button.value ='Click 2 Install' Txt1.innerHTML="Press this to install the apps that have been checked."} else {Install_Button.value ='Install Apps',Txt1.innerHTML="";}} /* <-- CLOSE BUTTON CHANGE TEXT --> */ function Button3ChangeText() { if (Close_Button.value =="Exit") {Close_Button.value ='Close This'} else {Close_Button.value ='Exit';}} </SCRIPT> <script language="VBScript"> '/--> ONLOAD EVENT Function window_Onload() : window.ResizeTo 475,285 : End Function'/--> INSTALL ALL APPS Function Install() If ChkBx1.Checked Then window.alert "Confirm Alcohol 120%" ' If Fso.FileExists(PLACE THE PATH AND NAME HERE) Then ' Act.Run("PLACE THE PATH AND NAME AND SWITCHES HERE"), 0, True ' Else ' window.alert "Missing Alcohol 120%" ' End If End If If ChkBx2.Checked Then window.alert "Confirm DVD Decrypter" ' If Fso.FileExists(PLACE THE PATH AND NAME HERE) Then ' Act.Run("PLACE THE PATH AND NAME AND SWITCHES HERE"), 0, True ' Else ' window.alert "Missing DVD Decrypter" ' End If End If If ChkBx3.Checked Then window.alert "Confirm DVD Shrink" ' If Fso.FileExists(PLACE THE PATH AND NAME HERE) Then ' Act.Run("PLACE THE PATH AND NAME AND SWITCHES HERE"), 0, True ' Else ' window.alert "Missing DVD Shrink" ' End If End If If ChkBx4.Checked Then window.alert "Confirm Ad-Aware" ' If Fso.FileExists(PLACE THE PATH AND NAME HERE) Then ' Act.Run("PLACE THE PATH AND NAME AND SWITCHES HERE"), 0, True ' Else ' window.alert "Missing Ad-Aware" ' End If End If If ChkBx5.Checked Then window.alert "Confirm AVG Anti-Virus" ' If Fso.FileExists(PLACE THE PATH AND NAME HERE) Then ' Act.Run("PLACE THE PATH AND NAME AND SWITCHES HERE"), 0, True ' Else ' window.alert "Missing AVG Anti-Virus" ' End If End If If ChkBx6.Checked Then window.alert "Confirm Crap Cleaner" ' If Fso.FileExists(PLACE THE PATH AND NAME HERE) Then ' Act.Run("PLACE THE PATH AND NAME AND SWITCHES HERE"), 0, True ' Else ' window.alert "Missing Crap Cleaner" ' End If End If If ChkBx7.Checked Then window.alert "Confirm Zone Alarm" ' If Fso.FileExists(PLACE THE PATH AND NAME HERE) Then ' Act.Run("PLACE THE PATH AND NAME AND SWITCHES HERE"), 0, True ' Else ' window.alert "Missing Zone Alarm" ' End If End If If ChkBx8.Checked Then window.alert "Confirm Application 8" ' If Fso.FileExists(PLACE THE PATH AND NAME HERE) Then ' Act.Run("PLACE THE PATH AND NAME AND SWITCHES HERE"), 0, True ' Else ' window.alert "Missing Application 8" ' End If End If End Function </SCRIPT> </HEAD><BODY> <!-- ===== CHECKBOX TABLE START ===== --> <TABLE width='95%' border='1' cellpadding='6'><TD Align='Center'> <!-- ===== ROW 001 START ===== --> <TABLE><TD ><TABLE> <!-- ===== CHECK BOX 001 START ===== --> <TD Width='125' Class='Text1'> <SPAN ID='Span1'>Alcohol 120%</SPAN></TD><TD> <INPUT Type='CheckBox' Style='Cursor:Hand;' OnMouseOver='ChangeText1()' OnMouseOut='ChangeText1()' Name='ChkBx1'></TD> <!-- ====== CHECK BOX 001 END ====== --> <TD Width='25'> </TD> <!-- ===== CHECK BOX 002 START ===== --> <TD Width='125' Class='Text1'><SPAN ID='Span2'>DVD Decrypter</SPAN></TD><TD> <INPUT Type='CheckBox' Style='Cursor:Hand;' OnMouseOver="ChangeText2()" OnMouseOut="ChangeText2()" Name='ChkBx2'></TD> <!-- ====== CHECK BOX 002 END ====== --> </TABLE></TD></TABLE> <!-- ====== ROW 001 END ====== --> <!-- ===== ROW 002 START ===== --> <TABLE><TD ><TABLE> <!-- ===== CHECK BOX 003 START ===== --> <TD Width='125' Class='Text1'><SPAN ID='Span3'>DVD Shrink</SPAN></TD><TD> <INPUT Type='CheckBox' Style='Cursor:Hand;' OnMouseOver='ChangeText3()' OnMouseOut='ChangeText3()' Name='ChkBx3'></TD> <!-- ====== CHECK BOX 003 END ====== --> <TD Width='25'> </TD> <!-- ===== CHECK BOX 004 START ===== --> <TD Width='125' Class='Text1'><SPAN ID='Span4'>Ad-Aware</SPAN></TD><TD> <INPUT Type='CheckBox' Style='Cursor:Hand;' OnMouseOver="ChangeText4()" OnMouseOut="ChangeText4()" Name='ChkBx4'></TD> <!-- ====== CHECK BOX 004 END ====== --> </TABLE></TD></TABLE> <!-- ====== ROW 002 END ====== --> <!-- ===== ROW 003 START ===== --> <TABLE><TD ><TABLE> <!-- ===== CHECK BOX 005 START ===== --> <TD Width='125' Class='Text1'><SPAN ID='Span5'>AVG Anti-Virus</SPAN></TD><TD> <INPUT Type='CheckBox' Style='Cursor:Hand;' OnMouseOver='ChangeText5()' OnMouseOut='ChangeText5()' Name='ChkBx5'></TD> <!-- ====== CHECK BOX 005 END ====== --> <TD Width='25'> </TD> <!-- ===== CHECK BOX 006 START ===== --> <TD Width='125' Class='Text1'><SPAN ID='Span6'>Crap Cleaner</SPAN></TD><TD> <INPUT Type='CheckBox' Style='Cursor:Hand;' OnMouseOver="ChangeText6()" OnMouseOut="ChangeText6()" Name='ChkBx6'></TD> <!-- ====== CHECK BOX 004 END ====== --> </TABLE></TD></TABLE> <!-- ====== ROW 003 END ====== --> <!-- ===== ROW 004 START ===== --> <TABLE><TD ><TABLE> <!-- ===== CHECK BOX 004 START ===== --> <TD Width='125' Class='Text1'><SPAN ID='Span7'>Zone Alarm</SPAN></TD><TD> <INPUT Type='CheckBox' Style='Cursor:Hand;' OnMouseOver='ChangeText7()' OnMouseOut='ChangeText7()' Name='ChkBx7'></TD> <!-- ====== CHECK BOX 007 END ====== --> <TD Width='25'> </TD> <!-- ===== CHECK BOX 008 START ===== --> <TD Width='125' Class='Text1'><SPAN ID='Span8'>Check Box 8</SPAN></TD><TD> <INPUT Type='CheckBox' Style='Cursor:Hand;' OnMouseOver="ChangeText8()" OnMouseOut="ChangeText8()" Name='ChkBx8'></TD> <!-- ====== CHECK BOX 004 END ====== --> </TABLE></TD></TABLE> <!-- ====== ROW 003 END ====== --> </TD></TABLE> <!-- ====== CHECKBOX TABLE END ====== --><p style="margin-top: 0; margin-bottom: 0"> </p><!-- BUTTON TABLE START --><TABLE><!-- RUN BUTTON START --> <TD Width='125' Align='Center'><Input type="button" Class='Button' Value="Install Apps" name="Install_Button" OnMouseOver="Button1ChangeText(),this.style.color='#40bee1';" OnMouseOut="Button1ChangeText(),this.style.color='#E1E1E1';" onClick="Install()"></TD><!-- CLOSE BUTTON START --> <TD Width='125' Align='Center'><Input type="button" Class='Button' Value="Exit" name="Close_Button" OnMouseOver="Button3ChangeText(),this.style.color='#40bee1';" OnMouseOut="Button3ChangeText(),this.style.color='#E1E1E1';" onClick="ExitThis()"></TD> <!-- BUTTON TABLE END --> </TABLE></CENTER><!-- GSM TABLE START --> <TABLE><TD WIDTH='236' HEIGHT='37' Class='Text1'><SPAN ID='Txt1'></SPAN></TD> <TD><FONT Style='font:8.75pt;Color:#E1E1E1;'><Sub><B>© 2006 GSM. All Rights Reserved</B></Sub></FONT></TD></TABLE><!-- GSM TABLE END --> </BODY></HTML>Here is the rar file off the above script Edited May 12, 2007 by gunsmokingman Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now