我有一个简单的脚本,我不想在最后关闭(退出)。我希望它能够从头开始。
Dim FJobName, objShell, FRevent, FReventNo, FPrevJobName
FJobName=InputBox ("Job Name","Plates Complete","ACT")
result=Msgbox(FJobName ,vbYesNo, "New Job?")
If result = vbYes Then
FRevent="raiseevent SetJobStatus_r3 " & FJobName & " InCart New -host 194.128.255.22 -port 61235"
Set objShell = WScript.CreateObject ("WScript.shell")
objShell.run FRevent
Else
If result = vbNo Then
result=Msgbox(FJobName ,vbYesNo, "Repeat Job?")
If result = vbYes Then
FPrevJobName=InputBox ("Previous Job Name?","Plates Complete","")
result=Msgbox(FPrevJobName ,vbYesNo, "Is this correct?")
If result = vbYes Then
FReventNo="raiseevent SetJobStatus_r3 " & FJobName & " InCart Repeat " & FPrevJobName & " -host 194.128.255.22 -port 61235"
Set objShell = WScript.CreateObject ("WScript.shell")
objShell.run FReventNo
End If
End If
End If
End If
答案 0 :(得分:1)
将代码包裹在while循环中。您可以设置结束标准或提示用户。这些方面的东西:
While 1=1
' *Your Code Here*
' Prompt user to quit/continue
If msgbox("Continue?", vbYesNo) = vbNo Then
WScript.quit
End If
' Alternately check criteria to quit/continue
if myQuitCriteria = True Then
WScript.quit
End If
Wend