Results 1 to 9 of 9

Thread: Custom message box with custom options buttons

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Oct 2012
    Posts
    23

    Custom message box with custom options buttons

    Hi I am sorry but I am rather new to vbs scripting however I have some experience in bat and cmd files> Here is my question.
    I would like to make a vbs file that starts on start up giving me a message reading "What would you like to do?" Than it should have three option buttons as follows
    "Start Internet Explorer"-Starts internet explorer
    "Run kill processes"-runs a vbs file that kills all processes not needed
    "Start windows update"-Start windows update
    "Continue as usual"-Close box and do nothing\
    If anyone can give me the code or help me I would reallly appretiate it
    Last edited by Joacim Andersson; Oct 19th, 2012 at 01:28 PM.

  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Custom message box with custom options buttons

    Moved to the VBScript forum

  3. #3
    Lively Member
    Join Date
    Dec 2010
    Location
    http://bbat.forumeiro.com/
    Posts
    86

    Lightbulb Re: [RESOLVED] Custom message box with custom options buttons

    Quote Originally Posted by SILENT001 View Post
    Hi I am sorry but I am rather new to vbs scripting however I have some experience in bat and cmd files> Here is my question.
    I would like to make a vbs file that starts on start up giving me a message reading "What would you like to do?" Than it should have three option buttons as follows
    "Start Internet Explorer"-Starts internet explorer
    "Run kill processes"-runs a vbs file that kills all processes not needed
    "Start windows update"-Start windows update
    "Continue as usual"-Close box and do nothing\
    If anyone can give me the code or help me I would reallly appretiate it
    Hi
    This example shows how to handle multiple forms in a single HTA, using the innerHTML method:

    and this example show you how to monitor all the running process that you can check each process for security issues online and of course you can kill one process or all its instances
    So i think if you read the code source of each one and you try to combine it in one HTA, you will be able to reach your aim

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Oct 2012
    Posts
    23

    Re: Custom message box with custom options buttons

    Its not suppose to be in html. I want make it a .vbs file.

  5. #5
    Lively Member
    Join Date
    Dec 2010
    Location
    http://bbat.forumeiro.com/
    Posts
    86

    Lightbulb Re: Custom message box with custom options buttons

    Hi
    Try this example with InputBox instead of Buttons:
    Code:
    Titre = "What would you like to do ? © Hackoo © 2012"
    message = "What would you like to do ?"&vbcr&vbcr&_
    "1 - Launch Internet Explorer "&vbcr&_
    "2 - Killing Process Not Needed "&vbcr&_
    "3 - Launch An Application"&vbcr&_
    "4 - Start Windows Update"
    Default ="1"
    Question = InputBox(message,Titre,Default)
    Select Case Question 
    Case 1 Run(1)
    Case 2 Run(2)
    Case 3 Run(3)
    Case 4 Run(4)
    end Select
    
    Sub Run(var)
    Set WS = CreateObject("WScript.shell")
            Select Case var
            Case 1 WS.run("iexplore.exe")
            Case 2 ProcessNotNeeded()
            Case 3 LaunchApplication()
            Case 4 WindowsUpdate()
    End select
    End Sub 
    
    Sub Kill(Process)
    Set Ws = CreateObject("Wscript.Shell")
    Command = "cmd /c Taskkill /F /IM "&Process&""
    Execution = Ws.Run(Command,0,False)
    End Sub
    
    Sub ProcessNotNeeded()
    Titre = "Killing Process Not Needed © Hackoo © 2012"
    message = "Type the Name of the process to be killed by this script"&vbcr&_
    "Example To Kill The Internet Explorer Process You should type"&vbcr&_
    "iexplore.exe"
    Default ="iexplore.exe"
    Question = InputBox(message,Titre,Default)
    Kill(Question)
    End Sub
    
    Function CmdPrompt(sCmd)
    Dim sCmdLine,oWS,nRes
    set oWS = CreateObject("Wscript.Shell")
    sCmdLine = "cmd /c Start " & sCmd & ""
    nRes = oWS.Run(sCmdLine,0,False)
    CmdPrompt = nRes
    End Function
    
    Sub LaunchApplication()
    Titre = "Launching an Application"
    message = "Type the Name of the process to be Lanuched by this script"&vbcr&_
    "Example To Launch The Word Application You should type"&vbcr&_
    "Winword.exe"
    Default ="Winword.exe"
    Question = InputBox(message,Titre,Default)
    CmdPrompt(Question)
    End Sub
    
    Sub WindowsUpdate()
    Title = "Checking for Windows updates"
    Msg = "Looking for a list of updates, So be Patient Thank you !"
    Wait = "5" 'waiting 5 secondes to close the popup
    Set Ws = CreateObject("Wscript.Shell")
    ws.Popup Msg,wait,Title,64
    
    Set updateSession = CreateObject("Microsoft.Update.Session")
        Set updateSearcher = updateSession.CreateupdateSearcher()        
        Set searchResult = updateSearcher.Search("IsInstalled=0 and Type='Software'")
    
    If searchResult.Updates.Count <> 0 Then 'If updates were found
        'so with this loop shows how you can list the title of each update that was found.
        For i = 0 To searchResult.Updates.Count - 1
            Set update = searchResult.Updates.Item(i)
            ws.Popup update.Title,wait,Title,64
        Next
    End If
    Ws.Run "wuauclt.exe /reportnow /detectnow",1,False
    End Sub
    Last edited by Hackoo; Oct 20th, 2012 at 12:38 PM. Reason: Adding Function for Windows Update

  6. #6
    Lively Member
    Join Date
    Dec 2010
    Location
    http://bbat.forumeiro.com/
    Posts
    86

    Thumbs up Re: Custom message box with custom options buttons

    Hi
    In this script you can add and save a list of the windows Update in a text file C:\ListWindowsUpdate.txt:
    Code:
    Titre = "What would you like to do ? © Hackoo © 2012"
    message = "What would you like to do ?"&vbcr&vbcr&_
    "1 - Launch Internet Explorer "&vbcr&_
    "2 - Killing Process Not Needed "&vbcr&_
    "3 - Launch An Application"&vbcr&_
    "4 - Start Windows Update"
    Default ="1"
    Question = InputBox(message,Titre,Default)
    Select Case Question 
    Case 1 Run(1)
    Case 2 Run(2)
    Case 3 Run(3)
    Case 4 Run(4)
    end Select
    
    Sub Run(var)
    Set WS = CreateObject("WScript.shell")
            Select Case var
            Case 1 WS.run("iexplore.exe")
            Case 2 ProcessNotNeeded()
            Case 3 LaunchApplication()
            Case 4 WindowsUpdate()
    End select
    End Sub 
    
    Sub Kill(Process)
    Set Ws = CreateObject("Wscript.Shell")
    Command = "cmd /c Taskkill /F /IM "&Process&""
    Execution = Ws.Run(Command,0,False)
    End Sub
    
    Sub ProcessNotNeeded()
    Titre = "Killing Process Not Needed © Hackoo © 2012"
    message = "Type the Name of the process to be killed by this script"&vbcr&_
    "Example To Kill The Internet Explorer Process You should type"&vbcr&_
    "iexplore.exe"
    Default ="iexplore.exe"
    Question = InputBox(message,Titre,Default)
    Kill(Question)
    End Sub
    
    Function CmdPrompt(sCmd)
    Dim sCmdLine,oWS,nRes
    set oWS = CreateObject("Wscript.Shell")
    sCmdLine = "cmd /c Start " & sCmd & ""
    nRes = oWS.Run(sCmdLine,0,False)
    CmdPrompt = nRes
    End Function
    
    Sub LaunchApplication()
    Titre = "Launching an Application"
    message = "Type the Name of the process to be Lanuched by this script"&vbcr&_
    "Example To Launch The Word Application You should type"&vbcr&_
    "Winword.exe"
    Default ="Winword.exe"
    Question = InputBox(message,Titre,Default)
    CmdPrompt(Question)
    End Sub
    
    Sub WindowsUpdate()
    Title = "Checking for Windows updates"
    Msg = "Looking for a list of updates, So be Patient Thank you !"
    Wait = "5" 'waiting 5 secondes to close the popup
    Set Ws = CreateObject("Wscript.Shell")
    ws.Popup Msg,wait,Title,64
    Set fso = CreateObject("Scripting.FileSystemObject")
    set ts = fso.CreateTextFile("C:\ListWindowsUpdate.txt",2,TRUE)
    Set updateSession = CreateObject("Microsoft.Update.Session")
    Set updateSearcher = updateSession.CreateupdateSearcher()        
    Set searchResult = updateSearcher.Search("IsInstalled=0 and Type='Software'")
    x=0
    If searchResult.Updates.Count <> 0 Then 'If updates were found
        'so with this loop shows how you can list the title of each update that was found.
        For i = 0 To searchResult.Updates.Count - 1
            x=x+1
            Set update = searchResult.Updates.Item(i)
            Mess = Mess & Update.Title & Vbcr
        Next
        ts.write "le Nombre de mise à jour est " & x & vbcr & Mess
        MsgBox "le Nombre de mise à jour est " & x & vbcr & Mess,64,Title
        ws.run "Notepad C:\ListWindowsUpdate.txt",1,False
    End If
    Ws.Run "wuauclt.exe /reportnow /detectnow",1,False
    End Sub
    Last edited by Hackoo; Oct 22nd, 2012 at 07:18 AM.

  7. #7
    Lively Member
    Join Date
    Dec 2010
    Location
    http://bbat.forumeiro.com/
    Posts
    86

    Angry Re: Custom message box with custom options buttons

    Quote Originally Posted by SILENT001 View Post
    Its not suppose to be in html. I want make it a .vbs file.
    I posted until now two VBS codes, and No Reply or comment from you i mean SILENT001 ????

  8. #8
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Custom message box with custom options buttons

    Maybe his/her user name could give you a hint to why he/she hasn't replied.

    Kidding apart, there could be a number of reasons that the OP hasn't replied and getting annoyed and bumping a thread only to require a response is considered bad manner in this forum so please stop doing that.

  9. #9

    Thread Starter
    Junior Member
    Join Date
    Oct 2012
    Posts
    23

    Re: Custom message box with custom options buttons

    I am so sorry that I have taken so long to reply but I have been rather busy with work. I want to say thank you to all of those whom have helped me and just say that I have taken my idea in a new direction. Since I am knowledged in html coding I have decide to create a desktop gadget to do all he things I have wanted to do and each button has its own script that it runs however I do have other threads that I have started which I need help with the scripting the link to one of them ishttp://www.vbforums.com/showthread.p...program-closes and the other which i just posted a few minutes ago is still awaiting moderation but as soon as the thread is accepted by the moderator I will post the link here for those whom wish to further aid me> Thank you all once again and I appologise once again for the late reply

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width