Hello All,
I haven't used the HTML aspect of WSH/VBS up to this point in my scripting so I'm a little confused on how to accomplish what I'm trying to develope.
I Have the need to use a WHS/VBS script to send HTMl/<script> srteams to IE in order to allow the script to use a ( script generated ) HTML interface for user Input / output.
Below is what I've got so far, the problem I'm having is with the button <tag>.
If you view the source from the script generated html page and paste it in to a static html page it works as it should, but in the generated verison the button does not work.
What have I done or not done correctly?
Any help would be appreciated.
(code will cut and paste in working fashion from this webpage )
_____________________________________________________________________________________________________
Start Script
_____________________________________________________________________________________________________
Set MSIE = CreateObject("InternetExplorer.Application"
On Error Resume Next
'
'Setup IE for Display Box.
'
SetupMSIE
MSIE.Document.Write "<HTML><TITLE>HTML / VBS Testing</TITLE><BODY bgcolor=#ffffff><FONT FACE=ARIAL>"
MSIE.Document.Write "<B>Please Make A Selection</B><BR>"
'
'***Select Elements***
'
C_1 = "Choice 1"
C_2 = "Choice 2"
C_3 = "Choice 3"
C_4 = "Choice 4"
C_5 = "Choice 5"
C_6 = "Choice 6"
C_7 = "Choice 7"
'
'***Select Input Box***
'
MSIE.Document.Write "<select>"
MSIE.Document.Write "<option selected>"&C_1&"</option>"
MSIE.Document.Write "<option>"&C_2&"</option>"
MSIE.Document.Write "<option>"&C_3&"</option>"
MSIE.Document.Write "<option>"&C_4&"</option>"
MSIE.Document.Write "<option>"&C_5&"</option>"
MSIE.Document.Write "<option>"&C_6&"</option>"
MSIE.Document.Write "<option>"&C_7&"</option>"
MSIE.Document.Write "</select>"
'
'***Select Button***
'
MSIE.Document.Write "<INPUT TYPE="&chr (34)&"Button"&chr (34)&" NAME="&chr (34)&"Button1"&chr (34)&" VALUE="&chr (34)&"Select"&chr (34)&"><SCRIPT FOR="&chr (34)&"Button1"&chr (34)&" EVENT="&chr (34)&"onClick"&chr (34)&" LANGUAGE="&chr (34)&"VBScript"&chr (34)&">MsgBox "&chr (34)&"Button Pressed!"&chr (34)&"</SCRIPT>"
MSIE.Document.Write "<HR>"
MSIE.Document.Write "<BR>Thank You!"
MSIE.Document.Write "</Body></HTML>"
'
'***Show The Exact HTML CODE BEING SENT TO IE***
'
Wscript.Echo "<INPUT TYPE="&chr (34)&"Button"&chr (34)&" NAME="&chr (34)&"Button1"&chr (34)&" VALUE="&chr (34)&"Click"&chr (34)&"><SCRIPT FOR="&chr (34)&"Button1"&chr (34)&" EVENT="&chr (34)&"onClick"&chr (34)&" LANGUAGE="&chr (34)&"VBScript"&chr (34)&">MsgBox "&chr (34)&"Button Pressed!"&chr (34)&"</SCRIPT>"
'
'*** Setup Internet Explorer ***
'
Sub SetupMSIE
MSIE.Navigate "About:Blank"
MSIE.ToolBar = False
MSIE.StatusBar = False
MSIE.Resizable = False
Do
Loop While MSIE.Busy
SWidth = MSIE.Document.ParentWindow.Screen.AvailWidth
SHeight = MSIE.Document.ParentWindow.Screen.AvailHeight
MSIE.Width = SWidth * .3
MSIE.Height = SHeight * .3
MSIE.Left = (SWidth - MSIE.Width)/2
MSIE.Top = (SHeight - MSIE.Height)/2
MSIE.Visible = True
End Sub
I haven't used the HTML aspect of WSH/VBS up to this point in my scripting so I'm a little confused on how to accomplish what I'm trying to develope.
I Have the need to use a WHS/VBS script to send HTMl/<script> srteams to IE in order to allow the script to use a ( script generated ) HTML interface for user Input / output.
Below is what I've got so far, the problem I'm having is with the button <tag>.
If you view the source from the script generated html page and paste it in to a static html page it works as it should, but in the generated verison the button does not work.
What have I done or not done correctly?
Any help would be appreciated.
(code will cut and paste in working fashion from this webpage )
_____________________________________________________________________________________________________
Start Script
_____________________________________________________________________________________________________
Set MSIE = CreateObject("InternetExplorer.Application"
On Error Resume Next
'
'Setup IE for Display Box.
'
SetupMSIE
MSIE.Document.Write "<HTML><TITLE>HTML / VBS Testing</TITLE><BODY bgcolor=#ffffff><FONT FACE=ARIAL>"
MSIE.Document.Write "<B>Please Make A Selection</B><BR>"
'
'***Select Elements***
'
C_1 = "Choice 1"
C_2 = "Choice 2"
C_3 = "Choice 3"
C_4 = "Choice 4"
C_5 = "Choice 5"
C_6 = "Choice 6"
C_7 = "Choice 7"
'
'***Select Input Box***
'
MSIE.Document.Write "<select>"
MSIE.Document.Write "<option selected>"&C_1&"</option>"
MSIE.Document.Write "<option>"&C_2&"</option>"
MSIE.Document.Write "<option>"&C_3&"</option>"
MSIE.Document.Write "<option>"&C_4&"</option>"
MSIE.Document.Write "<option>"&C_5&"</option>"
MSIE.Document.Write "<option>"&C_6&"</option>"
MSIE.Document.Write "<option>"&C_7&"</option>"
MSIE.Document.Write "</select>"
'
'***Select Button***
'
MSIE.Document.Write "<INPUT TYPE="&chr (34)&"Button"&chr (34)&" NAME="&chr (34)&"Button1"&chr (34)&" VALUE="&chr (34)&"Select"&chr (34)&"><SCRIPT FOR="&chr (34)&"Button1"&chr (34)&" EVENT="&chr (34)&"onClick"&chr (34)&" LANGUAGE="&chr (34)&"VBScript"&chr (34)&">MsgBox "&chr (34)&"Button Pressed!"&chr (34)&"</SCRIPT>"
MSIE.Document.Write "<HR>"
MSIE.Document.Write "<BR>Thank You!"
MSIE.Document.Write "</Body></HTML>"
'
'***Show The Exact HTML CODE BEING SENT TO IE***
'
Wscript.Echo "<INPUT TYPE="&chr (34)&"Button"&chr (34)&" NAME="&chr (34)&"Button1"&chr (34)&" VALUE="&chr (34)&"Click"&chr (34)&"><SCRIPT FOR="&chr (34)&"Button1"&chr (34)&" EVENT="&chr (34)&"onClick"&chr (34)&" LANGUAGE="&chr (34)&"VBScript"&chr (34)&">MsgBox "&chr (34)&"Button Pressed!"&chr (34)&"</SCRIPT>"
'
'*** Setup Internet Explorer ***
'
Sub SetupMSIE
MSIE.Navigate "About:Blank"
MSIE.ToolBar = False
MSIE.StatusBar = False
MSIE.Resizable = False
Do
Loop While MSIE.Busy
SWidth = MSIE.Document.ParentWindow.Screen.AvailWidth
SHeight = MSIE.Document.ParentWindow.Screen.AvailHeight
MSIE.Width = SWidth * .3
MSIE.Height = SHeight * .3
MSIE.Left = (SWidth - MSIE.Width)/2
MSIE.Top = (SHeight - MSIE.Height)/2
MSIE.Visible = True
End Sub