I have the following script and at the end I want to prompt the user
with a MsgBox to validate their entries. Two things:
1) How do I pass the values they entered into the msgbox?
2) I have added the yes/no option buttons but don't want cancel to be
included. I want the yes button to end the script as it does, but if
they select no, I want the script to run from the top.
Here is my mess
Dim strReturnVal1, strReturnVal2, strReturnVal3, strName, strKeyName,
strType
Dim g_objShell :Set g_objShell = createobject("WScript.Shell")
Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\LLNL"
oReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath
strName = "HKEY_LOCAL_MACHINE\SOFTWARE\LLNL" 'Change path to correct
location.
strKeyName = "\DOE #"
strtype = "REG_SZ"
GetUserInput strReturnVal1
'//Add your code here to put strReturnVal1 into reg!
g_objShell.RegWrite strname & strKeyName, strReturnVal1,strType
' User Input Function
Sub GetUserInput(strReturnVal1)
Dim strChoice1
strChoice1 = InputBox("Please input Machine DOE #")
If strChoice1 = "" Then
'Flag an Error is Null
strReturnVal1 = "BAD Usage"
else
strReturnVal1 = strChoice1
end if
End Sub
strName = "HKEY_LOCAL_MACHINE\SOFTWARE\LLNL" 'Change path to correct
location.
strKeyName = "\Building"
strtype = "REG_SZ"
GetUserInputa strReturnVal2
'//Add your code here to put strReturnVal into reg!
g_objShell.RegWrite strname & strKeyName, strReturnVal2,strType
' User Input Function
Sub GetUserInputa(strReturnVal2)
Dim strChoice2
strChoice2 = InputBox("Please input Building #")
If strChoice2 = "" Then
'Flag an Error is Null
strReturnVal2 = "BAD Usage"
else
strReturnVal2 = strChoice2
end if
End Sub
strName = "HKEY_LOCAL_MACHINE\SOFTWARE\LLNL" 'Change path to correct
location.
strKeyName = "\Room"
strtype = "REG_SZ"
GetUserInputb strReturnVal3
'//Add your code here to put strReturnVal3 into reg!
g_objShell.RegWrite strname & strKeyName, strReturnVal3,strType
' User Input Function
Sub GetUserInputb(strReturnVal3)
Dim strChoice3
strChoice3 = InputBox("Please input Room #")
If strChoice3 = "" Then
'Flag an Error is Null
strReturnVal3 = "BAD Usage"
else
strReturnVal3 = strChoice3
end if
End Sub
Dim MyVar
MyVar = MsgBox ("Is the data you entered correct?" & vbcrlf & "DOE #" &
vbcrlf & "Building #" & vbcrlf & "Room #",67,"CMS ISTeam")