Microsoft® Windows® Script Host <resource> Element |
WSH Reference Version 2 |
XML element that isolates textual or numeric data that should not be hard-coded into a script.
<resource id="resourceID">
text or number
</resource>
Part Description resourceID A unique identifier for the resource within the script.
The <resource> element allows you to isolate strings or numbers in your Windows script file that you want to reference in your scripts. For example, resource elements typically are used to maintain strings that may be localized into other languages.To get the value of a resource, call the getResource method, passing it the ID of the resource you want to use.
The following code fragment defines a resource (errNonNumeric) and returns its value if the variable upperBound is not numeric.<resource id="errNonNumeric"> Non-numeric value passed </resource> <script language="VBScript"> <![CDATA[ Function getRandomNumber(upperBound) If IsNumeric(upperBound) Then getRandomNumber = CInt(upperBound * Rnd + 1) Else getRandomNumber=getResource("errNonNumeric") End If End Function ]]> </script>