Option Explicit
Dim WshShell,PopQuestAbort,PopComputerAccountErr
Dim inpComputerAccount,inpGUID
Dim strChkComputerAccount,strChkGUID,ReRun
Dim strMsgHeader,strMsgComputerAccount,strMsgGUID
Dim strPopUpHeader,strPopQuestAbort,strComputerAccountErr,strGUIDErr
strMsgHeader="Some Header"
strMsgComputerAccount= "Correct string would be Check111111. Please input wrong string"
strPopUpHeader= "Confirm"
strPopQuestAbort="Abort?"
strComputerAccountErr="Wrong format, please input Check111111"
Const CheckString="CHEC"
Set WshShell = WScript.CreateObject("WScript.Shell")
If inpComputerAccount="" Then
GetComputerAccount
End If
'Analyze of input
inpComputerAccount=UCase(inpComputerAccount)
inpGUID=UCase(inpGUID)
strChkComputerAccount=Right(inpComputerAccount, 4)
strChkComputerAccount=Left(strChkComputerAccount, 1)
If Len(inpComputerAccount)=11 Then
If Left(inpComputerAccount, 4)=CheckString Then
If strChkComputerAccount=1 Then
'strChkComputerAccount="OK"
wscript.echo "ComputerAccount OK"
End If
End If
Else PopComputerAccountErr=WshShell.Popup(strComputerAccountErr,,strPopUpHeader,4 + 16)
Select Case PopComputerAccountErr
Case 6 GetComputerAccount
Case 7 wscript.quit
End Select
End If
'Getting ComputerAccount
Sub GetComputerAccount
Do While inpComputerAccount=""
inpComputerAccount = InputBox (strMsgComputerAccount,strMsgHeader)
If inpComputerAccount="" Then
PopQuestAbort=WshShell.Popup(strPopQuestAbort,,strPopUpHeader,4 + 32)
Select Case PopQuestAbort
Case 6 wscript.Quit
End Select
End If
Loop
End Sub