Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I haven't scripted in 15+ years. Please help!! 1

Status
Not open for further replies.

Robert.Bartman

IS-IT--Management
Aug 1, 2018
3
0
0
US
I have this code that I have borrowed bits and pieces of from multiple sources. The object of this code is for a technician to click submit on what software packages need to be installed on a computer. Then the script needs to make a file with the same name as the value of that submit button. I know how to do this by creating seperate subroutines for each submit button, but I would like to have one sub routine that parses the necessary data to create the proper file name. Can I use the value property to pass this information over to vbscript? Here is the code:

Code:
<HEAD>
<TITLE>HTA Sample</TITLE>
<hta:application
	applicationname="HTA Sample"
	scroll="yes"
	singleinstance'"yes"
	>
</HEAD>
 
<SCRIPT language="vbscript">
Set objFSO=CreateObject("Scripting.FileSystemObject")
Sub dymo
	str1 = "dymo"
outFile="c:\test\dymo.txt"
Set objFile = objFSO.CreateTextFile(outFile,True)
objFile.Write  str1
objFile.Close	
msgBox "File Created"
End Sub

</SCRIPT>
 
<BODY STYLE="FONT:10 pt verdana; COLOR:black; filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='#FFCC66', EndColorStr='#FFFFFF')">
 
<input id=runbutton class= "button" type="button" value="Dymo" name="button1" onClick="dymo"><BR>
 <input id=runbutton class= "button" type="button" value="RightFax" name="button2" onClick="RunThisSubroutine"><BR>
 <input id=runbutton class= "button" type="button" value="Vidyo" name="button3" onClick="RunThisSubroutine"><BR>
 <input id=runbutton class= "button" type="button" value="eCW Plugin Upgrade" name="button4" onClick="RunThisSubroutine"><BR>
 <input id=runbutton class= "button" type="button" value="eCW EXE Test" name="button5" onClick="RunThisSubroutine"><BR>
 <input id=runbutton class= "button" type="button" value="eCW Web Test" name="button6" onClick="RunThisSubroutine"><BR>
  <input id=runbutton class= "button" type="button" value="2x" name="button7" onClick="RunThisSubroutine"><BR>
 <input id=runbutton class= "button" type="button" value="Outlook" name="button8" onClick="RunThisSubroutine"><BR>
 <input id=runbutton class= "button" type="button" value="Skype" name="button9" onClick="RunThisSubroutine"><BR>
 <input id=runbutton class= "button" type="button" value="VPN" name="button1a" onClick="RunThisSubroutine"><BR>
 <input id=runbutton class= "button" type="button" value="Banner" name="button2a" onClick="RunThisSubroutine"><BR>
 
</BODY>
 
This should do it.

Code:
<HEAD>
<TITLE>HTA Sample</TITLE>
<hta:application
	applicationname="HTA Sample"
	scroll="yes"
	singleinstance'"yes"
	>
</HEAD>

<SCRIPT language="vbscript">
Set objFSO=CreateObject("Scripting.FileSystemObject")
Sub GetBtnVal
	str1 = window.event.srcelement.value
    outFile="c:\test\" & str1 & ".txt"
    Set objFile = objFSO.CreateTextFile(outFile,True)
    objFile.Write str1
    objFile.Close
    msgBox "File Created"
End Sub
</SCRIPT>
 
<BODY STYLE="FONT:10 pt verdana; COLOR:black; filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='#FFCC66', EndColorStr='#FFFFFF')">
 
 <input id=runbutton class= "button" type="button" value="Dymo" name="button1" onClick="VBScript:GetBtnVal()"><BR>
 <input id=runbutton class= "button" type="button" value="RightFax" name="button2" onClick="VBScript:GetBtnVal()"><BR>
 <input id=runbutton class= "button" type="button" value="Vidyo" name="button3" onClick="VBScript:GetBtnVal()"><BR>
 <input id=runbutton class= "button" type="button" value="eCW Plugin Upgrade" name="button4" onClick="VBScript:GetBtnVal()"><BR>
 <input id=runbutton class= "button" type="button" value="eCW EXE Test" name="button5" onClick="VBScript:GetBtnVal()"><BR>
 <input id=runbutton class= "button" type="button" value="eCW Web Test" name="button6" onClick="VBScript:GetBtnVal()"><BR>
 <input id=runbutton class= "button" type="button" value="2x" name="button7" onClick="VBScript:GetBtnVal()"><BR>
 <input id=runbutton class= "button" type="button" value="Outlook" name="button8" onClick="VBScript:GetBtnVal()"><BR>
 <input id=runbutton class= "button" type="button" value="Skype" name="button9" onClick="VBScript:GetBtnVal()"><BR>
 <input id=runbutton class= "button" type="button" value="VPN" name="button1a" onClick="VBScript:GetBtnVal()"><BR>
 <input id=runbutton class= "button" type="button" value="Banner" name="button2a" onClick="VBScript:GetBtnVal()"><BR>
 
</BODY>

Swi
 
Swi,

I wanted to say thank you for your reply it really helped me out. If you ever need anything 3d printed let me know. I would be happy to help you.
 
Robert.Bartman said:
I wanted to say thank you for your reply it really helped me out.

Do you see the Great Post link in swi’s lower eight-hand corner?

These little purple stars act as a “Thank you!” and identify posts for other members browsing for helpful tips.

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top