Talk:VBScript
This article is rated Start-class on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | |||||||||||||||||||||||||||
|
Wiki Education Foundation-supported course assignment
editThis article is or was the subject of a Wiki Education Foundation-supported course assignment. Further details are available on the course page. Student editor(s): Skang7, Milk Shake.
Above undated message substituted from Template:Dashboard.wikiedu.org assignment by PrimeBOT (talk) 12:12, 17 January 2022 (UTC)
Programming language
edit'Scripting' languages are labeled 'scripting' by what they are used for, not by their capabilities or limitations. This is a programming language article, and needs information on what paradigms VBScript supports, where it draws its roots from, etc. See [/Python_(programming_language)] for an example of paradigm description. —Preceding unsigned comment added by 216.205.223.34 (talk) 11:16, 6 May 2009 (UTC)
number of small issues
editThere's a number of small issues with this entry that I'm not going to attempt to fix right now:
- The last VBScript version is more recent that VB6, so it contains a couple of features not in VB6, but the significant ones are in VB.NET -- specifically I'm thinking of multiple classes in one file.
- IE doesn't implement VBScript or JavaScript -- both of these are supported (hosted) like add-ins -- there could be (are?) other scripting languages supported.
- VBScript and JavaScript, when hosted by IE, can produce stand-alone programs, using .hta files.
Mark Hurd 02:44, 2 Oct 2004 (UTC)
- "there could be (are?) other scripting languages supported." <- Indeed, IE can host any Active Scripting engine, available engines working in IE includes RubyScript, PerlScript, Python, ForthScript, Object Rexx and PHPScript. PhMajerus 15:12, 20 April 2007 (UTC)
- References to .hta (HTML Applications) have been clarified in this article, and a revised article on HTA created. DonToto (talk) 19:24, 14 April 2010 (UTC)
- I don't understand the comment "'If Visual Basic version isn't 6.0 or lower, you can also write it like this : MsgBox("Hello, World")" - VBScript syntax isn't dependent on the version of VB as it is a separate language. Perhaps that comment is best removed? YidaMala (talk) 18:57, 18 September 2016 (UTC)
Recent Changes
editI removed my comments from before about user education and the like here on the talk page. This talk page needs cleaned up, however. Also, I added back in the Criticism section nearly unedited (removed a useless line about "inherent insecurity" which was very POV) because I think some information about the .VBS extension being tied to one of the first major worms of the 90s is warranted. Ultimately ILOVEYOU was the start of "user education" and training that has become the mantra of "do not open unsolicited email" today. It's important to note what language such a worm was coded in and give VBS the proper criticism.
Notes
edit- VBScript has nothing to do with the newer VB.NET, except for the similarity of basic language keywords.
- IE in fact can host any active scripting langauge, as can any host. Windows Script Host (WSH), for example, can host other languages, including the third-party ActivePerl.
- Technically speaking, IE does not host an HTA. An HTA (HTML application, or .hta file) is an HTML file which contains client-side code written in a supported language, such as VBScript. They are executed by mshta.exe, which instantiates the Internet Explorer rendering engine (mshtml) as well as any required language engines (such as vbscript.dll). This is not the actual Internet Explorer application, although it's not commonly understood that IE is in fact two components: The app, and the underlying HTML rendering engine.
- VBScript is considered "end of development" by Microsoft, meaning v5.6 is the last. However, it is not considered "end of life" and is scheduled for inclusion in forthcoming releases of Windows for the forseeable future. It has gained significant support from Windows administrators seeking an automation tool more powerful than the batch language first developed in the late 1970s.
-- IE7 installs VBScript 5.7. I couldn't find any official information on the improvements, and didn't run across any new feature yet, but some people reported improved performances. PhMajerus 17:00, 13 April 2007 (UTC)
- The minor improvements in 5.7 are listed in 5.7's Release Notes. Also, I do not believe IE 7 installs v5.7 (on WinXP SP2 at least) because I checked two of my PCs that have IE7 and cscript still gives a v5.6 prompt. Also, there's a mention of a separate download for v5.7 on Windows Script Host --Georgeryp 16:15, 11 September 2007 (UTC)
-It should also be noted that there are more scripting hosts then mentioned. Microsoft Windows Installer for example has it's own scripting host for calling VBScript and JScript custom actions.
-And there are other scripting language engines. PerlScript and PythonScript are two that come to mind.
--Perl and Python are both scripting languages, but neither one has script in the name. Just FYI.
---The Active Scripting version of Perl distributed by ActiveState is named ActivePerl, the engine's ProgID is "PerlScript" and its friendly name is "PerlScript Language". The context of this article being the Active Scripting flavor of Visual Basic, it seems correct to refer to "PerlScript" for the Active Scripting flavor of Perl. ActivePython's engine ProgID on the other hand is "Python" (or "Python.AXScript.2" for version-dependent ProgID in ActivePython 2.4), so "PythonScript" would indeed be incorrect, the friendly name for Python.AXScript.2 is "Python ActiveX Scripting Engine". PhMajerus 17:00, 13 April 2007 (UTC)
Yeah, whatever User:PhMajerus. The 'L' in Perl is "Language" as in "Practical Extraction and Report Language". So it's a language not a script, like "Visual Basic Script" as in a script written in the Visual Basic language. A script written in perl is called a perl script, not a PerlScript script. ActiveState Perl is an implementation of perl by ActiveState. I think Python was originally RedHat's baby and again ActivePython is an implementation by those guys. So it's perl and python you pedant 81.174.174.31 (talk) 22:47, 21 July 2009 (UTC)
-The Hosting Environment link doesn't seem to be right. It's pointing to the hardware/networking concept, not the software execution environment concept. — Preceding unsigned comment added by WhatsMyHandle (talk • contribs) 17:33, 7 November 2013 (UTC)
-chart of features by version - http://msdn2.microsoft.com/en-us/library/4y5y7bh5(VS.85,printer).aspx
Visual Basic for Windows CE
editVBScript has also been used as the foundation to provide a Visual Basic application environment on Windows CE (Pocket PC, Palm-size PC, Handheld PC and embedded devices), often referred to as VBCE. In this environment, a desktop IDE similar to the classic Visual Basic IDE is used to create VBScript files and VB forms. The project get packaged in a single .vb archive, which is loaded on the device by pvbload.exe. Windows CE Toolkit for Visual Basic 5 and Windows CE Toolkit for Visual Basic 6 added this environment to the classic Visual Basic IDE, replaced later by a standalone product called eMbedded Visual Basic 3.0. This runtime environment loads the standard VBScript engine and feeds it with the script files contained in the .vb archive, loads the forms definitions and expose them as COM Automation objects to the script. This environment, enhanced with ADO/CE and other ActiveX controls, provide an experience similar to Visual Basic on the desktop. Interpreting the code using the VBScript engine, this had the advantage of being CPU-idenpendant, which was a good thing with the different processor architectures supported by Windows CE. The second version of the VBCE environment, supported by eMbedded Visual Basic 3.0, included support to invoke API functions from VBScript. This environment is now replaced by VB.NET and the .NET Compact Framework. PhMajerus 14:47, 20 April 2007 (UTC)
Constants
editThe main article now includes a list of values for MsgBox, but the complete list is useless, as it's only a small set of values that gets combined together. Note VBScript includes constants for all these values, making them much easier to remember.
MsgBox
editButtons: vbOKOnly = 0, vbOKCancel = 1, vbAbortRetryIgnore = 2, vbYesNoCancel = 3, vbYesNo = 4, vbRetryCancel = 5. Icons: vbCritical = 16, vbQuestion = 32, vbExclamation = 48, vbInformation = 64. Flags: vbDefaultButton1 = 0, vbDefaultButton2 = 256, vbDefaultButton3 = 512, vbDefaultButton3 = 512, vbApplicationModal = 0, vbSystemModal = 4096 (vbDefaultButton* defines which button is the default button). Return values: vbOK = 1, vbCancel = 2, vbAbort = 3, vbRetry = 4, vbIgnore = 5, vbYes = 6, vbNo = 7. Buttons, icons and flags can be combined to get the desired buttons and icons on the MsgBox (using the Or operator). As these values shows, the first button is the default if no other is specified (vbDefaultButton1 = 0) and the message box is application modal (vbApplicationModal = 0). MsgBox returns the value corresponding to the selected button.
Colors
editRGB Colors: vbBlack = &h00, vbRed = &hFF, vbGreen = &hFF00, vbYellow = &hFFFF, vbBlue = &hFF0000, vbMagenta = &hFF00FF, vbCyan = &hFFFF00, vbWhite = &hFFFFFF.
Strings
editStrings: vbCr = Chr(13), VbCrLf = Chr(13)&Chr(10), vbFormFeed = Chr(12), vbLf = Chr(10), vbNewLine = Chr(13)&Chr(10) or Chr(10) (depending on platform), vbNullChar = Chr(0), vbNullString = null string, vbTab = Chr(9), vbVerticalTab = Chr(11).
Other
editVBScript also includes constants for comparison modes, date and time values, date formats, error numbers, tristate values, and variant types. VBScript being an Active Scripting engine, the host can also add its own constants to the engine. Finally, Automation objects can contain their own constants in their type library, which some host let you import. For example, the Windows Script Host lets you import constants from type libraries using the <reference> element in WSF files, Windows Script components also use the <reference> element in WSC files, and Majerus.net Active Shell lets you import constants into an object using the GetConsts function.
Deleted Excessive Links
editI deleted these external links per Wikipedia: External links
Removed unnecesary criticism
editYou can write a virus in any language. Should we have a criticism section for assembly because viruses have been written using that language?--71.232.157.145 (talk) 04:56, 7 December 2007 (UTC)
what about .VBS files, these can be executed which people may not know. most other languages however still come in .exe or .com file formats. —Preceding unsigned comment added by 90.209.214.45 (talk) 19:50, 8 April 2008 (UTC)
- That may be a valid criticism.--71.232.157.145 (talk) 23:38, 9 May 2008 (UTC)
Link Spam
editIn an attempt to combat link spam, I've added the substituted template {{subst:NoMoreLinks}} to the external links section as per Wikipedia:Spam#Tagging_articles_prone_to_spam Christopher G Lewis (talk) 20:58, 15 February 2008 (UTC)
Please propose any new links here before you add them to the main page Christopher G Lewis (talk) 05:46, 23 February 2008 (UTC)
other comments
editthere is a suggestion that VBScript & Windows Script Host be merged
I object to this - VBScript is a programming language whereas Windows Script Host is the platform on which it (& others) run
Alanthehat (talk) 18:32, 4 March 2008 (UTC)
- VBscript an JScript are part of the Windows Scripting Host redistributable package. There is one help document and a single installation file. The installation schedule for v5.7 currently looks like this, and has not changed since v1.0:
- [SourceDisksFiles]
- jscript.dll = 1
- vbscript.dll = 1
- scrrun.dll = 1
- dispex.dll = 1
- scrobj.dll = 1
- wshom.ocx = 1
- wshext.dll = 1
- cscript.exe = 1
- wscript.exe = 1
= 1
- wscript.hlp = 1
- scripten.inf = 1
Socrates2008 (Talk) 07:51, 5 March 2008 (UTC)
I am not in favour of merging since WSH as Alanthehat said is a platform, VBScript is just one supported language on WSH. WSH also supports JScript, Perl and many other scripting languages. As the name says, its the host/runtime for these languages. VBScript and JScript are MS supplied. Therefore, the two articles should definitely not be merged. —Preceding unsigned comment added by 221.128.180.152 (talk) 13:45, 14 March 2008 (UTC)
- Well, I am also against them being merged. While they might be distributed together, they are not the same thing. In fact, one can happily exist without the other. VBScript, JScript, ActivePerl, ActivePython all are Active Scripting modules that can plug in to applications supporting the Active Scripting platform, of which Windows Script Host is just one instance, just as Internet Explorer is. You can strip out any of them and the rest will still continue working fine. A perfect analogy would be the .NET Framework, which also ship with C# and VB.NET compilers, but they are individual entities in their own rights. Similarly, Microsoft Visual Studio is the development platform for CLI languages - that doesn't make it lose its individual identity either. Same is the case here - just (manually) install WSH without VBScript or JScript but some other AS language, it will work as good. Similarly, use VBScript with some other host like IE or your custom AS client, there won't be any problem either. And, btw, I am not sure of VBScript, but IE8 did include a version of JScript separate from WSH. --soum talk 14:24, 14 March 2008 (UTC)
- Agreed - Removing merge tag. Christopher G Lewis (talk) 17:03, 14 March 2008 (UTC)
Viruses/Security
editMight worth including a section on VBScript viruses, and how the scripting environment has been locked down since the first release of VBScript to try to address this. (e.g. kill bit on high risk ActiveX controls, IE zone security etc) Socrates2008 (Talk) 03:57, 15 March 2008 (UTC)
Now() vs Now
editTo avoid a WP:3RR issue: IMHO VBScript, and VB6, have an essential quality that brackets are not required for subroutine and function calls. It's one of the first major changes to VB.NET cited as a breaking change. As such I don't believe spurious ()'s should be included in the sample code. Mark Hurd (talk) 09:00, 3 March 2009 (UTC)
- Fair point. My understanding of best practice for function calls was to include brackets (even when not passing a parameter), as this helps distinguish them from sub procedures, where no brackets are used (unless, of course you use the Call function); and when writing sample code in an article, it's better to follow best practice rather than what you can get away with (unless the article is about that). However, on reflection, I realise that the Now function can accept no parameters anyway and references for the Now function shows it without a bracket (Now Function on MSDN). I have undone my reversion. Greyskinnedboy (talk) 23:10, 3 March 2009 (UTC)
- This is a question of style and readability. Without brackets, it's not as easy for an untrained eye to differentiate between functions and statements, so I take the opposite view. Furthermore, the use of brackets to denote functions is common across many languages, so many people unfamiliar with the langugage will intuitively understand what this means. However there's absolutely no need to revert another author over this. Option Explicit may be "spurious" too, but adds considerable value in improving code quality. Socrates2008 (Talk) 22:28, 25 April 2009 (UTC)
- Yeah, although I felt it was right for the code to use just
Now
, although I didn't revert the change because of the consistency, I disliked the dropping of () in the commentary. Mark Hurd (talk) 02:47, 26 April 2009 (UTC)- For anyone who doesn't understand, it would look a bit odd having the comments say something different to the code, it's better for it to be consistent. From your and others' responses here, though, it looks like we might be getting toward consensus for brining back the () in the code and comments. After all, Option Explicit isn't needed but we think it's good to show it for best practice. Greyskinnedboy (talk) 05:29, 26 April 2009 (UTC)
- Yeah, although I felt it was right for the code to use just
- This is a question of style and readability. Without brackets, it's not as easy for an untrained eye to differentiate between functions and statements, so I take the opposite view. Furthermore, the use of brackets to denote functions is common across many languages, so many people unfamiliar with the langugage will intuitively understand what this means. However there's absolutely no need to revert another author over this. Option Explicit may be "spurious" too, but adds considerable value in improving code quality. Socrates2008 (Talk) 22:28, 25 April 2009 (UTC)
Content on HTML Applications
editI propose to move the details about an HTML Application to the linked article on this topic. I am referring to the following sentences:
mshta.exe is a 'Trusted Application Environment' provided by Internet Explorer. The 'Trusted Application Environment' implies that HTAs do not suffer the restrictions applied to applications running in the web or intranet zone, such as the inablity to access local files or network paths. Although HTAs run in this 'trusted' environment, querying Active Directory can be subject to Internet Explorer Zone logic and associated error messages.
These sentences are good content but seem to me more applicable to 'HTML Applications' than to 'VBScript' per se.
(Since I am new to this, I am making a proposal first, thereby putting more weight on the Wikipedia principle of civility than on the principle of being bold.) DonToto (talk) 21:36, 9 April 2010 (UTC)
- I did the above. DonToto (talk) 19:38, 14 April 2010 (UTC)
List of File Extensions
editCouldn't .hta be included in the list of file extensions used with VBScript, seeing as .htm and .html are included? —Preceding unsigned comment added by DonToto (talk • contribs) 21:37, 9 April 2010 (UTC)
- I added .hta to list. DonToto (talk) 19:29, 16 April 2010 (UTC)
May 2010 – Current quality rating
editI have been working away (adding, editing, re-arranging) this article to try and improve the quality rating. Note that all the "original" content is still there in one form or another. Previous comments on this discussion page were / are extremely helpful. Have included the info, e.g. notes on constants (but no list), examples of VBScript best practice (to give a taste of the language) following suggested conventions re brackets, etc. More work contemplated - add one or two graphics, add back a few references, add 2 examples on relation to VBA and accessing DOM, mention class support in language section, and a few other bits. Any suggestions for what to add? Did VBScript really influence PowerShell from a linguistic / syntactic point of view? I have looked up a few users but not sure if anyone else actively looking at this page. Will shortly submit this page for re-assessment under WikiProject Computing and WikiProject Microsoft Windows. DonToto (talk) 17:50, 6 May 2010 (UTC)
May 2014 - Version History
editIt appears there have been subsequent versions up to at least 5.8, as documented by Microsoft themselves: http://msdn.microsoft.com/en-us/library/4y5y7bh5%28v=vs.84%29.aspx — Preceding unsigned comment added by 212.219.142.118 (talk) 12:06, 28 May 2014 (UTC)
Debugging in Visual Studio
editplease see http://krestenm.blogspot.gr/2007/12/vbscript-projects-in-visual-studio2.html — Preceding unsigned comment added by 193.92.212.76 (talk) 12:25, 29 January 2015 (UTC)
Edit Plan
edit1. In the article, VBScript is named as "Visual Basic Scripting Edition". The full name of VBScript should be "Microsoft® Visual Basic® Scripting Edition". 2. I think the name of this lead section :VBScript functionality not available in VB 6.0, makes user confuse. I suggest “VBScript functionalities”, the description section said these functionalities is not available in VB 6.0. 3. More information of the latest version VBScript. — Preceding unsigned comment added by Skang7 (talk • contribs) 21:53, 11 September 2016 (UTC)
Baluchi Baluchi state
editblasts big DX