0

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
1
  • 1
    I have formatted your code as code, next time choose to do this yourself, the button can be found on the edit window menu bar and look like this: {} To ensure a prompt answer, you might like to take the time to indent. Commented Jun 17, 2011 at 14:46

1 Answer 1

1

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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.