Windows Script Components  

getResource Function

Gets the value of a resource defined with the <resource> element.

value = getResource(resourceID)


A unique identifier for the resource within the script component.


The <resource> element allows you to isolate strings or numbers in your script component that you want to intermingle with script in your script component. For example, resource elements are typically used to maintain strings that might be localized into another language. You can use the getResource function in the script component's script to extract the contents of a <resource> element.


The following script component fragment defines a resource (called errNonNumeric) and how to use it in script.

Note   A CDATA section is required to make the script in the <script> element opaque. For details, see Script Component Files and XML Conformance.
   <method name="random" internalName="getRandomNumber"/>
<resource id="errNonNumeric">Non-numeric value passed</resource>

<script language="VBScript">
Function getRandomNumber(upperBound)
   If IsNumeric(upperBound) Then
      getRandomNumber = Cint(upperBound * Rnd + 1)
   End If
End Function

See Also

Referencing Other Components