1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Development VBS Help

Discussion in 'Software' started by ModMonkey, 13 Nov 2008.

  1. ModMonkey

    ModMonkey Size 11 Carbon footprint

    22 Sep 2003
    Likes Received:
    I'm no coder, but I need to create a script that informs users that Outlook needs to be closed in order to upgrade a part of the system.

    I've got the actual script down without any problems but i want to ensure that the pop up stays on top at all times. I've found some examples with google but I don't know how to add the extra code into my working script.

    Here's what I have, its pieced together from googling examples:

    Dim WshShell, BtnCode, Status
    Status = 1
    Do While Status = 1
    Set WshShell = WScript.CreateObject("WScript.Shell")
    Set ProcessSet = GetObject("winmgmts:{impersonationLevel=impersonate}").ExecQuery("select * from Win32_Process")
    'WScript.Echo Status
    For each Process in ProcessSet
    	If Process.Description = "OUTLOOK.EXE" then
    		BtnCode = WshShell.Popup("The Outlook Send & File upgrade requires Outlook to be closed." &vbCr & "Please exit Outlook and click OK.", , "WARNING", 1 + 16)
    			Select Case BtnCode
    '			case 1      WScript.Echo "Thank you for closing Outlook"
    '			case 2      WScript.Echo "You cannot cancel"
    			End Select
    		Status = 1
    		Exit For
    		Status = 0
    	End If
    'WScript.Echo Status
    Any gurus out there able to help a brother?
  2. trigger

    trigger Procrastinator

    22 Mar 2004
    Likes Received:
    How's about using MsgBox instead of Popup? That way you could have a Yes/No answer, and the MsgBox is app modal by default and can even be set to system modal if required. However I do wonder - if you aren't letting them press Cancel and the button is modal. how are they ever going to close Outlook?

    Could you do this on login instead, that way the closing Outlook issue becomes moot...

Share This Page