Intouch Plugins

IntFromString() Script Function

The InTouchâ„¢ script function IntFromString() converts a given numeric string into an integer value based on a given Base (that is, Base 2, 8, 10, 16, or 32). IntFromString() requires that you supply the integer base of the string within a range of 2 to 35. IntFromString() is limited to InTouch’s 32-bit integer range of -2,147,483,648 to 2,147,483,647. If you supply a value that is outside of this range, then a zero value (0) is returned and an error message is logged to the Wonderware Logger.

Note If the numeric string that is passed to IntFromString() contains invalid characters or numbers for the specified base value, then the invalid characters will be ignored and IntFromString() will return an incorrect number with no errors or warnings. Invalid characters include punctuation characters (“,”, “!”, “;”, etc.). Invalid numbers are when the given numeric string is not a valid base value. For example, if a numeric string of ‘1’ is entered with a base of ‘8’, then a value of ‘1’ is returned. If a numeric string of ’19’ is enterd with a base of ‘8’, then again, a value of ‘1’ is returned because 9 is not a valid base-8 character (0-7 are valid).

Installing the IntFromString() Function

Download the file for Windows NT from the Wonderware Knowledge Base.

Unzip the file that you downloaded, then the copy the files WWHEX.DLL, WWHEX.WDF and README.TXT into your InTouch directory.

Using the IntFromString() Function


<Integer_tag> = IntFromString(<Numeric_Text>, <Base>);

Where <Integer_tag> is a valid InTouch Integer tagname, <Numeric_Text> is the given numeric string that is converted to an integer value using the specified <Base> value (that is, 2, 8, 10, 16 or 32).

For example, IntFromString( “FF”, 16 ) will return a value of 255; IntFromString( “11010”, 2 ) will return a value of 26; and IntFromString( “8”, 10 ) will return a value of 8.

Leave a Reply

Your email address will not be published. Required fields are marked *

5 × 10 =