Reputation: 21
I have have a simple script that I do not wish to close (exit) at the end. I would like it to start at the beginning again.
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
Upvotes: 0
Views: 1793
Reputation: 321
Wrap your code in a while loop. You can set ending criteria or prompt the user. Something along these lines:
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
Upvotes: 1