Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
VBScript
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Environments== ===Client-side web=== In a web page loaded by [[Internet Explorer]], VBScript is similar in function to [[JavaScript]]. The VBScript code in the HTML is logic that interacts with the [[Document Object Model]] (DOM) of the page {{endash}} allowing for functionality not possible in HTML alone. However, other web browsers such as [[Google Chrome|Chrome]], [[Firefox]] and [[Opera (web browser)|Opera]] do not support VBScript. Therefore, when client-side scripting and cross-browser compatibility are required, developers usually choose JavaScript due to its wide cross-browser compatibility. ===Active server page=== VBScript is used for server-side web page functionality via [[Active Server Pages]] (ASP). The ASP engine, {{Mono|asp.dll}}, invokes {{Mono|vbscript.dll}} to run VBScript scripts. VBScript that is embedded in an ASP page is contained within <% and %> context switches. The following example displays the current time in 24-hour format. <syntaxhighlight lang="aspx-vb" line="1"> <% Option Explicit %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>VBScript Example</title> </head> <body> <div><% ' Grab current time from Now() function. ' An '=' sign occurring after a context switch (<%) is shorthand ' for a call to the Write() method of the Response object. Dim timeValue : timeValue = Now %> The time, in 24-hour format, is <%=Hour(timeValue)%>:<%=Minute(timeValue)%>:<%=Second(timeValue)%>. </div> </body> </html> </syntaxhighlight> ===Windows script host=== VBScript can run directly in the operating system via the [[Windows Script Host]] (WSH). A script file, usually with [[file extension|extension]] <code>.vbs</code> can be run either via {{Mono|Wscript.exe}} for [[graphical user interface]] (GUI) or {{Mono|Cscript.exe}} for [[command line interface]] (CLI). ===Windows script file=== A [[Windows Script File]] (WSF), styled after XML, can include multiple VBS files and is therefore a library of VBScript code that can be reused in a modular way. The files have extension <code>.wsf</code> and can be executed using {{Mono|wscript.exe}} or {{Mono|cscript.exe}}, as with a <code>.vbs</code> file. ===HTML Application=== An [[HTML Application]] (HTA) is styled after HTML. The HTML in the file is used to generate the user interface, and a scripting language such as VBScript is used for the program logic. The files have extension <code>.{{Not a typo|hta}}</code> and can be executed using {{Mono|mshta.exe}}. ===Windows Script Component=== VBScript can also be used in a Windows Script Component, an ActiveX-enabled script class that can be invoked by other COM-enabled applications.<ref>[http://msdn2.microsoft.com/en-us/library/07zhfkh8(VS.85).aspx ''Introducing Windows Script Components''], on MSDN</ref> These files have extension {{Mono|.wsc}}.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)