lapucca
asked on
Why my while loop not working?
Correction!!! I do not see this program running in the Task Manager.
This vb script supposed to reboots the pc . It pops up a dialog that has a Yes and a No buttons that does the following.
If they click Yes then restart, if they click No, delay for 10 minutes, then prompt again.
If they hit No a second time, delay 10 minutes, and then prompt again.
If they hit No a third time, delay 10 minutes and then prompt again.
On the 4th time, give them with a message that the computer will restart in 5 minutes with a count down, and then restart the box.
I run the script and it promopts me, I selected no. I never got the popup dialog box again. Please help on how to fix this.
pcReboot2.vbs
This vb script supposed to reboots the pc . It pops up a dialog that has a Yes and a No buttons that does the following.
If they click Yes then restart, if they click No, delay for 10 minutes, then prompt again.
If they hit No a second time, delay 10 minutes, and then prompt again.
If they hit No a third time, delay 10 minutes and then prompt again.
On the 4th time, give them with a message that the computer will restart in 5 minutes with a count down, and then restart the box.
I run the script and it promopts me, I selected no. I never got the popup dialog box again. Please help on how to fix this.
pcReboot2.vbs
ASKER
got error, please see attached.
I think it needs "objShell = WScript.CreateObject("WScr ipt.Shell" )"
Quesiton, do I need to create a new object shell each time I need to run a objShell codes? In C# I usually dispose object to clean up. Do I not need to do this in VBScript?
Thank you.
codeErr.jpg
I think it needs "objShell = WScript.CreateObject("WScr
Quesiton, do I need to create a new object shell each time I need to run a objShell codes? In C# I usually dispose object to clean up. Do I not need to do this in VBScript?
Thank you.
codeErr.jpg
I see several issues, and will take a look later tonight if this is still open...
~bp
~bp
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you both for responding. I found my own logic error. I used the wrong variable here
Sub Main()
If numOfDelays < 3 Then
(I used iRetVal before and that's wrong)
Sub Main()
If numOfDelays < 3 Then
(I used iRetVal before and that's wrong)
Open in new window