Message box used in vbscript that won't stop the script

Author Message
mbouchard

  • Total Posts : 2110
  • Scores: 29
  • Reward points : 0
  • Joined: 5/15/2003
  • Location: USA
  • Status: offline
Message box used in vbscript that won't stop the script Wednesday, August 10, 2005 1:38 AM (permalink)
0
I have mentioned this in several posts as of late, so I thought that I would post it here.  My non-modal message box using AutoIT.  This will be in 3 parts.  1 is a readme, which, hopefully explains the usage fairly well.  2, is the splashtext autoitscript, and 3 is the vbscript used to call the splashtext file.

What you will need
1) Go to www.hiddensoft.com, download AutoIT and install it on one PC.  If you install it then you can right click on the AU3 file and click compile, if you don't install it and just unzip it, think that this can still be done, then you will need to run the AUT2EXE file.
2) create a file called splashtext.au3, copy and past the AutoIT code below
3) Right click on Splashtext.au3 and click compile
4) in same folder as the splashtext, create a vbs file and copy and paste the vbscript below

Then launch it.

Mike

For useful Scripting links see the Read Me First stickey!

Always remember Search is your friend.
 
#1
    mbouchard

    • Total Posts : 2110
    • Scores: 29
    • Reward points : 0
    • Joined: 5/15/2003
    • Location: USA
    • Status: offline
    RE: Message box used in vbscript that won't stop the script Wednesday, August 10, 2005 1:39 AM (permalink)
    0
    **Splashtext.AU3**
    Copy everything after the ___

    _____________________________________________________________

    ;NoFlashSplashTextSource.au3 precomplie
    ;Complied name = splashtext.exe
    AutoItSetOption("TrayIconHide", 1);1 = Hide Icon

    If $cmdline[0]=1 then
      ; close the window
       $title= $CmdLine[1]
       WinClose($title)
    ElseIf $CMDline[0]=2 then
       $title= $CmdLine[1]
       $message= $CmdLine[2]
       $message = StringReplace($message, "^", @LF)
       ControlSetText($title,"","Static1", $message)
    ElseIf $CmdLine[0]>0 Then
       $title= $CmdLine[1]
       $message= $CmdLine[2]
       $wide = $CmdLine[3]
       $high = $CmdLine[4]
       $xpos = $CmdLine[5]
       $ypos = $CmdLine[6]
       $opt = $CmdLine[7]
       $fsize = $CmdLine[8]
       $fweight = $CmdLine[9]
       $message = StringReplace($message, "^", @LF)
       WinClose($title)
       SplashTextOn($title, $message, $wide, $high, $xpos, $ypos, $opt, "", $fsize, $fweight)
       $s_title = $title
      ; loop till window is closed
       While WinExists($title)
          Sleep(50)
       wend
    EndIf

    Mike

    For useful Scripting links see the Read Me First stickey!

    Always remember Search is your friend.
     
    #2
      mbouchard

      • Total Posts : 2110
      • Scores: 29
      • Reward points : 0
      • Joined: 5/15/2003
      • Location: USA
      • Status: offline
      RE: Message box used in vbscript that won't stop the script Wednesday, August 10, 2005 1:40 AM (permalink)
      0
      RunSplashTextExample.vbs

      Same, copy everything after the ______

      ________________________________________

      Dim Fso : Set Fso = CreateObject("Scripting.FileSystemObject")
      Dim WshShell : Set WshShell = CreateObject("WScript.Shell")
      sTEST = "300 150 50 50 16 -1 -1"'position of window.  Look at the AutoIT Documentation for specifics
      'Note adding a ^ will cause a LF(1 LF per^).
      'SplashTextOn($title, $message, $wide, $high, $xpos, $ypos, $opt, "",$fsize,$fweight)
      sTitle = """This is the Title"" "
      sTitle1 = """You Can Even Change the Title"" "

      WshShell.Run "SplashText.exe " & stitle & """Testing SplashText"" " & "300 150 50 50 16 -1 -1" & vbcr
      wscript.sleep 2000
      WshShell.Run "SplashText.exe " & stitle & """You can make the fonts BIGGER"" " & "300 150 50 50 16 20 -1"
      wscript.sleep 2000
      WshShell.Run "SplashText.exe " & stitle & """You can make the fonts smaller"" " & "300 150 50 50 16 8 -1"
      wscript.sleep 2000
      WshShell.Run "SplashText.exe " & stitle & """The Text will wrap if it is too long for the window."" " & "300 150 50 50 16 -1 -1"
      wscript.sleep 2000
      WshShell.Run "SplashText.exe " & stitle & """You can change the window size."" " & "100 350 50 50 16 -1 -1"
      wscript.sleep 2000
      WshShell.Run "SplashText.exe " & stitle & """You can move the window."" " & "300 150 350 500 16 -1 -1"
      wscript.sleep 2000
      WshShell.Run "SplashText.exe " & stitle 'If you do not close the original window it will stay open when a window is opened with a new title.
      'Open a new window with a different title.
      WshShell.Run "SplashText.exe " & stitle1 & """Text is left Justified ^ and the window can be moved. ^ Pausing 7 seconds."" " & "300 150 50 50 20 -1 -1"
      wscript.sleep 7000
      WshShell.Run "SplashText.exe " & stitle1 'Run it again to close it
      WshShell.Run "SplashText.exe " & stitle & """Text is Right Justified ^ and the window can not be moved."" " & "300 150 50 50 8 -1 -1"
      wscript.sleep 4000

      'Start Smooth window transitions example
      WshShell.Run "SplashText.exe " & stitle & """Adding 1 of these (The Char above the number 6) will enter a LF^See^What^I^Mean."" " & "300 150 50 50 16 -1 -1"
      wscript.sleep 4000
      WshShell.Run "SplashText.exe " & stitle & """You can"""
      wscript.sleep 2000
      WshShell.Run "SplashText.exe " & stitle & """You can ^even make"""
      wscript.sleep 2000
      WshShell.Run "SplashText.exe " & stitle & """You can ^even make ^the Splash Window"""
      wscript.sleep 2000
      WshShell.Run "SplashText.exe " & stitle & """You can ^even make ^the Splash Window ^not Flash as """
      wscript.sleep 2000
      WshShell.Run "SplashText.exe " & stitle & """You can ^even make ^the Splash Window ^not Flash as ^it did before."""
      wscript.sleep 2000
      WshShell.Run "SplashText.exe " & stitle & """You can ^even make ^the Splash Window ^not Flash as ^it did before.^New Line"""
      wscript.sleep 2000
      WshShell.Run "SplashText.exe " & stitle & """You can ^even make ^the Splash Window ^not Flash as ^it did before.^New Line^Newer Line"""
      wscript.sleep 2000


      WshShell.Run "SplashText.exe " & stitle & """See the readme file for explinations of switches."" " & "350 100 50 50 20 -1 -1"
      wscript.sleep 2000
      WshShell.Run "SplashText.exe " & stitle 'Run it again to close it


      Mike

      For useful Scripting links see the Read Me First stickey!

      Always remember Search is your friend.
       
      #3
        mbouchard

        • Total Posts : 2110
        • Scores: 29
        • Reward points : 0
        • Joined: 5/15/2003
        • Location: USA
        • Status: offline
        RE: Message box used in vbscript that won't stop the script Wednesday, August 10, 2005 1:41 AM (permalink)
        0
        Read me

        SplashText.exe is a compiled AutoIT script.  It will display a configurable window.

        Command line to call it:
        WshShell.Run "SplashText.exe ""TITLE" " ""BODY" " WIDTH HEIGHT xPOS yPOS OPTIONS FONTSIZE FONTWEIGHT"

        (Taken from AutoIT help document)
        TITLE - Title for splash window.
        BODY - Text for splash window.
        WIDTH - Optional width of window in pixels. (default 500)
        HEIGHT - Optional height of window in pixels. (default 400)
        X POS - Optional position from left (in pixels) of splash window. (default is centered)
        Y POS - Optional position from top (in pixels) of splash window. (default is centered)

        OPTIONS - additional options: (add them up - default is 'center justified/always on top/with title')
         0 = Center justified/always on top/with title (default)
         1 = Thin bordered titleless window
         2 = Without "always on top" attribute
         4 = Left justified text
         8 = Right justified text
        16 = Windows can be moved

        FONTSIZE - Optional font size. (default is 12; standard sizes are 6 8 9 10 11 12 14 16 18 20 22 24 26 28 36 48 72)
        FONTWEIGHT - Optional font weight (0 - 1000, default = 400 = normal). A value > 1000 is treated as zero.-1 can be used to use defaults.



        To Call script
        Example
        WshShell.Run "SplashText.exe ""test Title"" ""Test Body"" 600 350 -1 -1 16 20 800"

        If you want to add carriage returns to the body portion use ^
        Example
        WshShell.Run "SplashText.exe ""test Title"" ""Test^Body^Using^Carriage^^Returns"" 600 350 -1 -1 16 20 800"

        To Close window:
        WshShell.Run "SplashText.exe ""test Title""" 'MUST be the same as the title when it was opened.


        No Flashing window Method

        Use the same script as above to call the exe...
        WshShell.Run "SplashText.exe ""test Title"" ""Test Body"" 600 350 -1 -1 16 20 800"

        BUT use only the Title and body for the next few lines
        WshShell.Run "SplashText.exe ""test Title" " ""Test Body1""

        See RunSplashTextexample.vbs for an example of this.
        Mike

        For useful Scripting links see the Read Me First stickey!

        Always remember Search is your friend.
         
        #4
          Fredledingue

          • Total Posts : 572
          • Scores: 2
          • Reward points : 0
          • Joined: 5/9/2005
          • Location: Europe
          • Status: offline
          RE: Message box used in vbscript that won't stop the script Friday, August 12, 2005 7:32 AM (permalink)
          0
          Ok with autoIt you can do everything, but a simple masgbox that doesn't stop the script is very easy to do even without autoIt.

          two ways:

          1/ create a script called "messagebox.vbs" with the code:
          msgbox "YourMessage",,"YourTitle"
          Then launch it using the wshell.run method

          2/ if the message is always changing:
          use a code in your script to create a text file and to write the MsgBox line into it and to launch the vbs file.
          Then delete the vbs file.

          Fred
           
          #5
            mbouchard

            • Total Posts : 2110
            • Scores: 29
            • Reward points : 0
            • Joined: 5/15/2003
            • Location: USA
            • Status: offline
            RE: Message box used in vbscript that won't stop the script Monday, August 15, 2005 1:56 AM (permalink)
            0
            This is not a "Best way of doing anything" forum, but a post your code.  While AutoIT can do many things, I do not think that it can do everything.  BUT it is helpful and useful.  In some cases someone might only need to use what you posted.  But others may want more, in that case, the post I made will benefit them.


            ORIGINAL: Fredledingue

            Ok with autoIt you can do everything, but a simple masgbox that doesn't stop the script is very easy to do even without autoIt.

            two ways:

            1/ create a script called "messagebox.vbs" with the code:
            msgbox "YourMessage",,"YourTitle"
            Then launch it using the wshell.run method

            2/ if the message is always changing:
            use a code in your script to create a text file and to write the MsgBox line into it and to launch the vbs file.
            Then delete the vbs file.
            Mike

            For useful Scripting links see the Read Me First stickey!

            Always remember Search is your friend.
             
            #6
              Briandr73

              • Total Posts : 11
              • Scores: 0
              • Reward points : 0
              • Joined: 11/27/2009
              • Status: offline
              Re: RE: Message box used in vbscript that won't stop the script Friday, November 19, 2010 7:54 AM (permalink)
              0
              Hi Mike,
              I came across this post by you through a google search. It is of great interest to me. I have done everything indicated in the directions. I am now trying to incorporate this into my own script I am setting up for installing XP SP3. Do I need to use the sleep directly below the 'wshShell.run'. Here is my code and the way I envision this the message created by 'splashtext.exe' will disappear after XP SP3 finishes installing. My only question is do I need wscript.sleep 3600000. That should be 60 minutes if google converted correctly and sleep is in miliseconds.
              
              
               
               
              #7
                Briandr73

                • Total Posts : 11
                • Scores: 0
                • Reward points : 0
                • Joined: 11/27/2009
                • Status: offline
                Re: RE: Message box used in vbscript that won't stop the script Friday, November 19, 2010 7:56 AM (permalink)
                0
                Mike,
                Here is my code. Had some problems pasting before.
                Feedback is very much appreciated. Thanks.
                 
                Const Hidden=0
                Const WaitonReturn=True
                Dim FSO 
                Set FSO=CreateObject("Scripting.FileSystemObject")
                set objNetwork=CreateObject("Wscript.Network")
                Set WshShell=CreateObject("Wscript.Shell")
                strComputerName=wshShell.ExpandEnvironmentStrings("%computername%")
                objNetwork.MapNetworkDrive "b:", "\abcwaltps\software", False, "mydomain\myuser", "mypassword"
                wshshell.CurrentDirectory="b:\xpsp3\"
                FSO.CopyFile "b:\WindowsXP-KB936929-SP3-x86-ENU.exe", "c:\windows\temp\"
                FSO.CopyFile "b:\SplashText.exe", "c:\windows\temp\"
                wshshell.CurrentDirectory="c:\windows\temp\"
                WshShell.Run "SplashText.exe ""Windows XP SP3 Installation"" ""End User Support is installing Windows XP SP3. The installation can take 45 minutes. This message will disappear when the installation has finished.", "" 600 350 -1 -1 16 20 800"
                wshshell.run "c:\windows\temp\WindowsXP-KB936929-SP3-x86-ENU.exe /quiet /norestart /log:c:\windows\temp\WindowsXP-KB936929-SP3-x86-ENU.log",0,True
                FSO.CopyFile "c:\windows\temp\windowsxp-kb936929-sp3-x86-enu.log", "b:\xpsp3\Logs\" & strComputerName & ".txt"
                Set FSO=nothing
                objNetwork.RemoveNetworkDrive "b:"
                <message edited by Briandr73 on Friday, November 19, 2010 8:05 AM>
                 
                #8

                  Online Bookmarks Sharing: Share/Bookmark

                  Jump to:

                  Current active users

                  There are 0 members and 1 guests.

                  Icon Legend and Permission

                  • New Messages
                  • No New Messages
                  • Hot Topic w/ New Messages
                  • Hot Topic w/o New Messages
                  • Locked w/ New Messages
                  • Locked w/o New Messages
                  • Read Message
                  • Post New Thread
                  • Reply to message
                  • Post New Poll
                  • Submit Vote
                  • Post reward post
                  • Delete my own posts
                  • Delete my own threads
                  • Rate post

                  2000-2012 ASPPlayground.NET Forum Version 3.9