Windows Script Components  

<resource> Element

Isolates textual or numeric data that should not be hard-coded into the script component's scripts.

<resource id="resourceID">
   text or number here
</resource>

Values

ResourceID
A unique identifier for the resource within the script component.

Remarks

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.

To get the value of a resource, call the getResource function, passing it the ID of the resource you want to use.

Example

The following script component fragment defines a resource (called errNonNumeric) and demonstrates 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.
<public>
   <method name="random" internalName="getRandomNumber"/>
</public>
<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>

See Also

Referencing Other Components