From: Sathya on 23 Mar 2010 07:52 hi, as per documentation msgbox will display "vbscript:" followed by user given title text. i want to get rid of it. it doesn't happen in my local browser (IE 7). but happens in another machine. can tht be handled in script. any advice is appreciated --- frmsrcurl: http://msgroups.net/microsoft.public.scripting.vbscript/
From: Todd Vargo on 23 Mar 2010 16:14 "Sathya" <user(a)msgroups.net/> wrote in message news:u4FoI9nyKHA.4752(a)TK2MSFTNGP04.phx.gbl... > hi, > as per documentation msgbox will display "vbscript:" followed by user > given title text. i want to get rid of it. it doesn't happen in my local > browser (IE 7). but happens in another machine. > can tht be handled in script. any advice is appreciated Perhaps you missed the following note in the remarks section. "When the MsgBox function is used with Microsoft Internet Explorer, the title of any dialog presented always contains "VBScript:" to differentiate it from standard system dialogs." I can not explain why your machine with IE7 did not display it, but it should have according to the documentation in SCRIPT56.CHM. -- Todd Vargo (Post questions to group only. Remove "z" to email personal messages)
From: MikeBlane on 23 Mar 2010 20:50 This is the code that I use to get rid of the "VBScript:" tag in the popup. I know it's a lot of overhead, but the end result is that most of this information ends up in my code anyway. Since it's all run with "Option Explicit", I know that this part of the code always works. '-- ---------------------------------------------------------------- Code: -------------------- Option Explicit 'Button Patterns in the popup dim vbOKButton, vbOKCancelButtons, vbAbortRetryIgnoreButtons dim vbYESNOCancelButtons, vbYESNOButtons, vbRetryCancelButtons vbOKButton = 0 vbOKCancelButtons = 1 vbAbortRetryIgnoreButtons = 2 vbYesNoCancelButtons = 3 vbYesNoButtons = 4 vbRetryCancelButtons = 5 'Popup Icons - already defined in VBScript ' vbCritical = 16 ' vbQuestion = 32 ' vbExclamation = 48 ' vbInformation = 64 Dim objFileSystem 'Scripting Dictionary object Dim objWshShell 'Windows Script Host Shell object Dim objWshNetwork 'Windows Script Host Network object Dim objWshEnvironment 'Windows Script Host environment object Set objFileSystem = CreateObject("Scripting.FileSystemObject") Set objWshShell = CreateObject("WScript.Shell") Set objWshNetwork = CreateObject("WScript.Network") Set objWshEnvironment = objWshShell.Environment("Process") 'Popup syntax ' intButton = objWshShell.popup("Popup Text", AutoTimeout in seconds, _ ' "Popup Title Bar", vbOKCancelButtons + vbExclamation) Dim intPopupAutoTimeout, intButton intPopupAutoTimeout = 15 ' seconds Dim strComputer, strComputerEnvname strComputerEnvname = objWshEnvironment("COMPUTERNAME") Dim intExtensionDot, strScriptName intExtensionDot = InStrRev(WScript.ScriptName, ".") strScriptName = Left(WScript.ScriptName, intExtensionDot - 1 ) intButton = objWshShell.popup("Program execution complete.", intPopupAutoTimeout, _ strScriptName & ": [" & strComputerEnvname & "]", vbOKButton + vbInformation) -------------------- '-- ---------------------------------------------------------------- This particular code gives the following message box: [image: http://www.vistax64.com/attachment.php?attachmentid=18804&stc=1&d=1269391592] If I replace the "vbOKButton + vbInformation" in the intButton = objWshShell.popup("Program execution complete.", intPopupAutoTimeout, _ strScriptName & ": [" & strComputerEnvname & "]", *vbOKButton + vbInformation*) with "vbExclamation + vbAbortRetryIgnoreButtons" like this: intButton = objWshShell.popup("Program execution complete.", intPopupAutoTimeout, _ strScriptName & ": [" & strComputerEnvname & "]", *vbExclamation + vbAbortRetryIgnoreButtons*) The output becomes: [image: http://www.vistax64.com/attachment.php?attachmentid=18805&stc=1&d=1269391592] Hope this helps. +-------------------------------------------------------------------+ |Filename: VBScript_Popup_Example_2.jpg | |Download: http://www.vistax64.com/attachment.php?attachmentid=18805| +-------------------------------------------------------------------+ -- MikeBlane
From: Todd Vargo on 23 Mar 2010 23:55 MikeBlane wrote: > > This is the code that I use to get rid of the "VBScript:" tag in the > popup. I know it's a lot of overhead, but the end result is that most of > this information ends up in my code anyway. Since it's all run with > "Option Explicit", I know that this part of the code always works. > > '-- ---------------------------------------------------------------- > > Code: > -------------------- > > > Option Explicit > 'Button Patterns in the popup > dim vbOKButton, vbOKCancelButtons, vbAbortRetryIgnoreButtons > dim vbYESNOCancelButtons, vbYESNOButtons, vbRetryCancelButtons > vbOKButton = 0 > vbOKCancelButtons = 1 > vbAbortRetryIgnoreButtons = 2 > vbYesNoCancelButtons = 3 > vbYesNoButtons = 4 > vbRetryCancelButtons = 5 > 'Popup Icons - already defined in VBScript > ' vbCritical = 16 > ' vbQuestion = 32 > ' vbExclamation = 48 > ' vbInformation = 64 > Dim objFileSystem 'Scripting Dictionary object > Dim objWshShell 'Windows Script Host Shell object > Dim objWshNetwork 'Windows Script Host Network object > Dim objWshEnvironment 'Windows Script Host environment object > Set objFileSystem = CreateObject("Scripting.FileSystemObject") > Set objWshShell = CreateObject("WScript.Shell") > Set objWshNetwork = CreateObject("WScript.Network") > Set objWshEnvironment = objWshShell.Environment("Process") > 'Popup syntax > ' intButton = objWshShell.popup("Popup Text", AutoTimeout in seconds, _ > ' "Popup Title Bar", vbOKCancelButtons + vbExclamation) > Dim intPopupAutoTimeout, intButton > intPopupAutoTimeout = 15 ' seconds > Dim strComputer, strComputerEnvname > strComputerEnvname = objWshEnvironment("COMPUTERNAME") > Dim intExtensionDot, strScriptName > intExtensionDot = InStrRev(WScript.ScriptName, ".") > strScriptName = Left(WScript.ScriptName, intExtensionDot - 1 ) > intButton = objWshShell.popup("Program execution complete.", > intPopupAutoTimeout, _ > strScriptName & ": [" & strComputerEnvname & "]", vbOKButton + > vbInformation) > -------------------- > > '-- ---------------------------------------------------------------- > > This particular code gives the following message box: > [image: > http://www.vistax64.com/attachment.php?attachmentid=18804&stc=1&d=1269391592] > > > If I replace the "vbOKButton + vbInformation" in the > > intButton = objWshShell.popup("Program execution complete.", > intPopupAutoTimeout, _ > strScriptName & ": [" & strComputerEnvname & "]", *vbOKButton + > vbInformation*) > > with "vbExclamation + vbAbortRetryIgnoreButtons" like this: > > intButton = objWshShell.popup("Program execution complete.", > intPopupAutoTimeout, _ > strScriptName & ": [" & strComputerEnvname & "]", *vbExclamation + > vbAbortRetryIgnoreButtons*) > > The output becomes: > [image: > http://www.vistax64.com/attachment.php?attachmentid=18805&stc=1&d=1269391592] > > Hope this helps. Are you running this in an .htm file or .vbs file? When I run in browser .htm I do not get a popup at all. Webpage error details User Agent: Mozilla/4.0 (compatible; MSIE 8.0; MSNIA; Windows NT 5.1; Trident/4.0) Timestamp: Wed, 24 Mar 2010 03:46:49 UTC Message: Variable is undefined: 'WScript' Line: 34 Char: 3 Code: 0 URI: file:///C:/test.htm Apperantly, it does not like "WScript.ScriptName" when run in the browser. -- Todd Vargo (Post questions to group only. Remove "z" to email personal messages)
From: sathya on 24 Mar 2010 05:04 cool. thanks for the replies guys. i used wshell.popup to achieve the result. thanks again :) --- frmsrcurl: http://msgroups.net/microsoft.public.scripting.vbscript/msgbox-title-issue
|
Pages: 1 Prev: How to check a AD user's password Next: Microsoft VBScript runtime error '800a0009' |