1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Anyone able to help with a VBS script please?

Discussion in 'Software Development' started by martinlest, Feb 22, 2015.

Thread Status:
Not open for further replies.
  1. martinlest

    martinlest Thread Starter

    Joined:
    Nov 11, 2010
    Messages:
    150
    I'd be grateful if any VBS 'guru' could advise! I have a messagebox script to run a programme, which is fine. But I am hardly an expert here and this is as far as I can get. What I am trying to achieve is for the message box to time out after say ten seconds if no manual choice is made, the box to close and the exe file to run (ie. default to the 'yes' option). Nothing I've tried works.

    I am out of my depth with this, so help appreciated,

    Thanks,

    Martin

    -------------------------------------------------

    intAnswer = _
    Msgbox(" Do you want to run FS9?", _
    vbYesNo, " ")

    If intAnswer = vbYes Then

    Dim objShell
    Set objShell = WScript.CreateObject( "WScript.Shell" )
    objShell.Run("""D:\FS9\fs9.exe""")
    Set objShell = Nothing

    Else

    End If
     
  2. martinlest

    martinlest Thread Starter

    Joined:
    Nov 11, 2010
    Messages:
    150
    It's OK, this script works (popup method).. Thanks to 59Cobalt at VBS forum...

    Set sh = CreateObject("WScript.Shell")
    answer = sh.Popup("Do you want to run FS9?", 10, "Title", vbYesNo)
    If answer = vbYes Or answer = -1 Then
    sh.Run "D:\FS9\fs9.exe"
    End If
     
  3. foxidrive

    foxidrive Banned

    Joined:
    Oct 20, 2012
    Messages:
    793
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Similar Threads - Anyone able help
  1. des000
    Replies:
    4
    Views:
    527
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1143590

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice