Login | |
|
 |
Message box used in vbscript that won't stop the script - 8/10/2005 12:38:04 AM
|
|
 |
|
| |
mbouchard
Posts: 1804
Score: 12
Joined: 5/15/2003
From: USA
Status: online
|
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.
|
|
| |
|
|
|
 |
RE: Message box used in vbscript that won't stop the sc... - 8/10/2005 12:39:46 AM
|
|
 |
|
| |
mbouchard
Posts: 1804
Score: 12
Joined: 5/15/2003
From: USA
Status: online
|
**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.
|
|
| |
|
|
|
 |
RE: Message box used in vbscript that won't stop the sc... - 8/10/2005 12:40:35 AM
|
|
 |
|
| |
mbouchard
Posts: 1804
Score: 12
Joined: 5/15/2003
From: USA
Status: online
|
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.
|
|
| |
|
|
|
 |
RE: Message box used in vbscript that won't stop the sc... - 8/10/2005 12:41:05 AM
|
|
 |
|
| |
mbouchard
Posts: 1804
Score: 12
Joined: 5/15/2003
From: USA
Status: online
|
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.
|
|
| |
|
|
|
 |
RE: Message box used in vbscript that won't stop the sc... - 8/12/2005 6:32:57 AM
|
|
 |
|
| |
Fredledingue
Posts: 321
Score: 0
Joined: 5/9/2005
From:
Status: offline
|
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
|
|
| |
|
|
|
 |
RE: Message box used in vbscript that won't stop the sc... - 8/15/2005 12:56:47 AM
|
|
 |
|
| |
mbouchard
Posts: 1804
Score: 12
Joined: 5/15/2003
From: USA
Status: online
|
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. quote:
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.
|
|
| |
|
|
|
| |
|
|
 |
|
 |
|
|