I found this code in tek-tips and have been trying to modify it to fit my needs. I want to create a popup box that will allow the user running the script to click on a button and then set a variable for the rest of the script to use. I can get the script below to create the buttons but how do I pass the variable back into the rest of the script. Ideally if I can get this to work it would all run inside of a subroutine and then pass the inputed information back to the main script.
Thanks for any input
Dan
Thanks for any input
Dan
Code:
Set objExplorer = wscript.CreateObject("InternetExplorer.Application","IE_")
objExplorer.Navigate "about:blank"
objExplorer.ToolBar = 0
objExplorer.StatusBar = 0
objExplorer.Width = 800
objExplorer.Height = 570
objExplorer.Left = 0
objExplorer.Top = 0
objExplorer.Visible = 1
variable = "0"
Set objDocument = objExplorer.Document
objDocument.Open
objDocument.Writeln "<html><head><title>CCN Announcement</title>"
objDocument.Writeln "<script language=VBScript>"
objDocument.Writeln "Sub cmdFull_onClick()"
objDocument.writeln "msgbox ""You have chosen to Do the Full Backup""" 'inserted for visual testing
objDocument.writeln "variable = 1"
objDocument.writeln "msgbox variable"
objDocument.writeln "WScript.Quit"
objDocument.writeln "End Sub"
objDocument.Writeln "Sub cmdPartial_onClick()"
objDocument.writeln "msgbox ""You have chosen to Do the Partial Backup""" 'inserted for visual testing
objDocument.writeln "variable = 2"
objDocument.writeln "msgbox variable"
objDocument.writeln "WScript.Quit"
objDocument.writeln "End Sub"
objDocument.writeln "</script>"
objDocument.writeln "</head>"
objDocument.Writeln "<body bgcolor=#5959ab>"
objDocument.Writeln "<h2>Communication Details</h2>"
objDocument.Writeln "<Br>"
objDocument.Writeln "<Br>"
objDocument.Writeln "<input align=centre id=cmdFull type=Button name=cmdFull value=""Full Backup"">"
objDocument.Writeln "<input align=centre id=cmdPartial type=Button name=cmdPartial value=""Partial Backup"">"
objDocument.Writeln "</body></html>"
'this is the single _most_ crucial step to make the script successful
objDocument.close
do while true : wscript.sleep 100 : loop
Sub IE_onQuit()
msgbox variable
' msgbox "onQuit event fired."
Wscript.Quit
End Sub