All Elements
ELEMENT: <script>
The
<script>
tag is used to insert a block of code into the .wsf XML data structure. With
<script>
tags, one can easily mix code written in different languages in the same execution block. External code can also be imported into a .wsf file via the
<script>
tag.
Syntax:
<script language="language" [src="strFilePath"]>...</script>
Attribute: language
The optional
language
attribute is used to specify which script engine is used to interpret the code inside the
script
tags. If the
language
attribute is omitted, the default script engine (JScript) is used.
Attribute: src
The optional
src
attribute can be used to import external code into the current .wsf file.
The following sample code illustrates various flavors of this tag.
<?XML version="1.0" ?>
<!-- Filename: demo.wsf-->
<package>
<job>
<script language="VBScript">
WScript.Echo "This is VBScript"
</script>
<script language="JScript">
WScript.Echo ("This is JScript") ;
</script>
<script language="VBScript" src="extcode.vbs">
WScript.Echo "Echo from internal code."
</script>
<script language="VBScript" src="extcode.vbs"/>
</job>
</package>
File:
extcode.vbs
WScript.Echo "Echo from external code"
Output:
This is VBScript
This is JScript
Echo from external code
Echo from internal code
Echo from external code
Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information