Scripting With Notepad-New question- Help is APPRECIATED!

Anyone who is good at scripting, Help.

I already know how to create a message box, and an input box. How do you make it so, when I click "No", it brings it to another message box, a different one then when I click "Yes"? I try googling it, but nothing interesting comes up. Any help is appreciated.

Edit:
Thanks for the help. But now I now I want to make it so i can Start a program in the middle of messageboxes. Theorictally, it should be something like this:
Code: vbscript
  1. msgbox "Hi, I'm gonna start the command prompt for you"
  2. start cmd


But that doesnt work?
I also downloaded that micrsoft thing you told me too. The help window says the action has been cancelled.
14,964 views 7 replies
Reply #1 Top
My first suggestion is to get this script documentation from Microsoft.
WWW Link

Then look at the MsgBox Function.

Here's how to do it in vbscript. For each button you select there is an assigned number that is returned. No = 7
Code: vbscript
  1. Dim MyVar
  2. MyVar = MsgBox ("Hello World!", 67, "MsgBox Example")
  3. ' MyVar contains either 1 or 2, depending on which button is clicked.
  4. If MyVar = 7 Then MyVar2=MsgBox("Wrong Answer!", 67, "Second Message Box")
Reply #2 Top
I'm no good with remembering what number means what; I use vbyesno.

Code: vbscript
  1. msg = Msgbox("Question", vbyesno)
  2. If msg = vbyes Then
  3. msgbox "Correct"
  4. Else
  5. msgbox "Incorrect!"
  6. End If



Just throwin' it out there. :)
Reply #3 Top
I'm no good with remembering what number means what; I use vbyesno.


I don't remember either; so, you're still ahead of me! :D
SirSmiley /huggles the WSH help file.

Oh, almost forgot change the 67 to just 4 to limit the msgbox to yes/no.
Reply #5 Top
But now I now I want to make it so i can Start a program in the middle of messageboxes.



That's a little trickier, and I'd like to know the answer to that as well. In my user experience the msgbox always has to be cleared before the script continues; could be wrong.

However, if you set the prompt on a timer before you put up the msgbox it will work; won't clear the msgbox though.


Example:

Code: vbscript
  1. Sub Object_OnScriptEnter
  2. object.SetTimer 1, 5000
  3. msgbox "Hi, I'm gonna start the command prompt for you"
  4. End Sub
  5. Sub Object_OnTimer1
  6. Object.KillTimer 1 '--Kill the timer first thing!
  7. msgbox "Does whatever"
  8. End Sub



The help window says the action has been cancelled


I'm getting that too. :NOTSURE:  I'm not sure what's wrong with it.
Reply #6 Top
Wait...are you using DesktopX at all?

If not, ignore the above script as it only pertains to DesktopX.
Reply #7 Top
The message box will suspend the script until you make a selection or close it.

With the details you've given it's hard to suggest something. If the program you're running is not tied to the result of the message box than the simplest suggestion is to make two subs & pause the sub that runs the app.

Code: vbscript
  1. Call MyApp 'The app sub must be called first or the message box sub will override it
  2. Call MyMessages
  3. Sub MyMessages
  4. Dim MyVar
  5. MyVar = MsgBox ("Hello World!", 4, "MsgBox Example")
  6. If MyVar = 7 Then MyVar2=MsgBox("Wrong Answer!", 4, "Second Message Box")
  7. End Sub
  8. Sub MyApp
  9. WScript.Sleep 100 'Time in milliseconds
  10. Set WshShell = WScript.CreateObject("WScript.Shell")
  11. WshShell.Run "%windir%\notepad "
  12. End Sub