Returns the value of a resource defined with the <resource> element.
Arguments
- resourceID
A string that uniquely identifies the resource information contained within a set of resource tags in a *.WSF script file.
Remarks
Example
The following WSH script defines a resource called errNonNumeric
. The value of errNonNumeric
is displayed if the parameter upperBound
is not a number.
| Copy Code |
---|
<package>
<job id="JS">
<resource id="errNonNumeric">Error: A non-numeric value was entered where a number was expected.</resource>
<script language="JScript">
function getRandomNumber(upperBound)
{
var realUpperBound = parseInt(upperBound);
if (!isNaN(realUpperBound))
return (realUpperBound * Math.random) + 1
else
{
WScript.Echo(getResource("errNonNumeric"));
WScript.Quit(-1);
}
}
NewValue = getRandomNumber("Bad Value");
</script>
</job>
<job id="VBS">
<resource id="errNonNumeric">Error: A non-numeric value was entered where a number was expected.</resource>
<script language="VBScript">
Function getRandomNumber(upperBound)
If IsNumeric(upperBound) Then
getRandomNumber = CInt(upperBound * Rnd + 1)
Else
WScript.Echo getResource("errNonNumeric")
WScript.Quit -1
End If
End Function
NewValue = getRandomNumber("Bad Value")
</script>
</job>
</package> |
See Also