Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Unable to pass variables from input

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,65109
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Unable to pass variables from input
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Unable to pass variables from input - 10/15/2008 5:55:00 AM   
  samash

 

Posts: 3
Score: 0
Joined: 10/8/2008
Status: offline
Hi.
I cant seem to figure out what i am missing in my script (hta). I am asking users to input two fields and then slect from a dropdown on the third field. I have one paramater set as a constant so that is fine. I am able to pass the costant variable, the dropdown variable but not the two user inputs. the variables are showing up as blanks so they are skipped. I tried to echo out the parameters so i could see what happens and get the first parameter as variable, 2nd ends up grabbing what should be the forth variable as the other two are blank. Items in red below are comments about what i see happening and not part of script. Any help would be very much appreciated.

<html>
<head>
<title>.::HP Enclosure Scan Tool::.</title>
<HTA:APPLICATION
    ID="HP Enclosure Scan Tool"
    APPLICATIONNAME="HP Enclosure Scan Tool"
    SCROLL="No"
    SINGLEINSTANCE="yes"
    WINDOWSTATE="maximize"
</head>
<SCRIPT Language="VBScript">
Dim strServer
Dim Srvcmmd
Dim Srvpwd
' declare constant
Const srvUser = "administrator"
' Clear all variables
srvOA = ""
srvpwd = ""

Sub Window_Onload
self.Focus()
self.ResizeTo 700,500
self.MoveTo 200,100
End sub

Sub ServerSelectList
   Set strServer = ServerSelection.Value  <- this variable is not getting info from input box below
End sub
Sub PwdSelectList
   set srvpwd = (PwdSelection.Value) <- this variable is not getting info from password box below
End sub
Sub RunScript
   Srvcmmd = DropDown.Value
End Sub
Sub RunButton
set wshell = CreateObject("WScript.Shell")
wshell.run "C:\temp\oa-ps\test\Plink.bat " & srvUser & " "& strServer & " "& srvpwd & " " & Chr(34) & Srvcmmd & Chr(34)
set wshell = nothing
end Sub

</SCRIPT>

<style>
body
{
background-color: buttonface;
font-family: Helvetica;
font-size: 12pt;
margin-top: 2px;
margin-left: 8px;
margin-right: 3px;
margin-bottom: 3px;
}
</style>
<body STYLE="
filterrogidXImageTransform.Microsoft.Gradient
(GradientType=1, StartColorStr='#CCCCCC', EndColorStr='#FFFFFF')">
<H2 align="center">HP Enclosure Scan Tool</H2>
<table border="0" cellpadding="0" cellspacing="0" style="width: 565px;
height: 104px">
<tr>
<td valign="top" style="height: 30px">
Input Enclosure:</td>
<td valign="top" style="height: 30px">
Admin Password:</td>
<td valign="top" style="height: 30px">
Select Command to Run:</td>
</tr>
<tr>
<td valign="top" style="width: 284px; height: 15px;">
<input type="text" id="ServerSelection" name="ServerSelectList" size="15" />&nbsp;
</td>
<td valign="top" style="width: 284px; height: 15px;">
<input type="text" id="PwdSelection" name="PwdSelectList" size="15" />&nbsp;
</td>
<td valign="top" style="width: 289px">
<select size="1" name="DropDown" onChange="RunScript">
<option value="0"></option>
<option value= "show rack name"> show rack name </option>
<option value= "show enclosure info"> show enclosure info </option>
<option value= "show oa status"> show oa status </option>
<option value= "show power"> show power </option>
<option value= "show interconnect port map all"> show interconnect port map all </option>
<option value= "show server info all"> show server info all </option>
<option value= "show enclosure temp"> show enclosure temp </option>
<option value= "show server temp all"> show server temp all </option>
</select></td>
<td valign="top" style="width: 284px">
</tr>
</table>
<input id=runbutton  class="button" type="button" value="Run Button" name="run_button"  onClick="Runbutton">
</body>
</html>.

Below is output i have echoing from script so i can see what it is passing

C:\temp\oa-ps\test>echo administrator
administrator
C:\temp\oa-ps\test>echo "show power"  <----- this one should be the 4th parameter
"show power"
C:\temp\oa-ps\test>echo <-----
ECHO is on.
C:\temp\oa-ps\test>echo
ECHO is on.
C:\temp\oa-ps\test>plink administrator@"show power" -ssh -pw    1>output.txt
plink: option "-pw" requires an argument

 
 
Post #: 1
 
 RE: Unable to pass variables from input - 10/15/2008 11:17:27 AM   
  wjcott

 

Posts: 41
Score: 0
Joined: 9/7/2008
Status: offline
It doesn't look like ServerSelectList or PwdSelectList  are being called. You may want to change RunButton sub to this:


      

< Message edited by wjcott -- 10/15/2008 11:19:07 AM >

(in reply to samash)
 
 
Post #: 2
 
 RE: Unable to pass variables from input - 10/15/2008 11:34:32 PM   
  samash

 

Posts: 3
Score: 0
Joined: 10/8/2008
Status: offline
Thanks that worked perfectly 

(in reply to wjcott)
 
 
Post #: 3
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Unable to pass variables from input Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts