Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
VBScript
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
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}}.
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
VBScript
(section)
Add topic