SurferScript Functions
Page Links Using Functions, Function Parameters, Function Quick Reference, Detailed Function Descriptions

Using Functions in Expressions

ScreenSurfer expressions allow the use of internal ScreenSurfer functions that can be used to manipulate text, read the screen and so on. These functions can be used any place a text or numeric literal might be used without concern for "data type".

Your requests for additional useful functions are welcome, as most functions in ScreenSurfer have been added based on customer requests.

As a general naming pattern, functions beginning with Text can be used in expressions in the same way as a text literal, and generally provide some form of text manipulation or transformation. Functions can be integrated directly with SurferScript expressions, which are used in <TEIF>, <TESET>, <TESHOW> <TEDATA>, <TEAREA> and a number of other tags.

Function Parameters

Note that many SurferScript functions have multiple "flavors" where the same function can be used with different numbers or types of parameters-- this is known as "overloading" and is supported in ScreenSurfer. For example, when checking on the current attribute for a field on the active screen, the FieldIsBold function can take one or two integer parameters. When one parameter is given, it is assumed to be the "zero-based" offset from the start of the active screen. When two parameters are given, they are assumed to be the 1-base row, column location. If you use this function with the result from a FindText function, you would use the single parameter, whereas if you were coding directly with a specific screen layout in mind, you may find the use of the row/column easier and more productive.

Special Variables

Note that due to the object-oriented nature of SurferScript variables, there are a number of special variables which act like functions. Thus, if you are trying to find a function to perform or query a particular value, you should also refer to the
Special Screen Variables section.

Function Quick Reference

Function Quick Reference
This chart contains the current function set for ScreenSurfer, organized by type. Click on a function for a more detailed description.
String/Text

FindText (SearchText, TextToFind)
Len (Text)

Length (Text)

TextClean (HTMLText)
TextEncode (URLText)
TextLeft (SourceText, Length)
TextLower (SourceText)
TextMid (SourceText, BaseZeroOffset, Length)
TextUpper (SourceText)
TextRight (SourceText, Length)
TextScreen (Offset, Length)
TextScreen (Row, Column, Length)
TextTrim (SourceText)
TextTrim (SourceText, CharListToTrim)
WebText (NameOfValue)
HTML Generation
AidButtons (ButtonSource, Options)
AidLinks (LinkSource, Target, Options)
AidScriptButtons (LinkSource, Target, Options)
Time/Date
Now ("GMT"|"Local")

Now ("GMT"|"Local", "MDY"|"DMY"|"YMD"|"YMDT")

Now ("GMT"|"Local", "MDY"|"DMY"|"YMD"|"YMDT", SepChar)
Math
Max (FirstNumber, SecondNumber)

Min (FirstNumber, SecondNumber)

Modulus (BaseNumber, Divisor)

Remainder (BaseNumber, Divisor)
Screen Interaction
FieldIsBold (Offset)

FieldIsBold (Row, Column)

FieldIsEntry (Offset)

FieldIsEntry (Row, Column)

FieldIsHidden (Offset)

FieldIsHidden (Row, Column)

FindNextBold (Offset)

FindNextBold (Row, Column)

FindNextEntry (Offset)

FindNextEntry (Row, Column)

FindNextField (Offset)

FindNextField (Row, Column)
Web/Session Management
FileExists (FullFilePathName)

GetColor (colorIndex)

SetClientCookie (CookieName, Value, PathRoot, HoursToExpiry)

SetColor (colorIndex, colorText)
Server Control
GetMaxSessions (LUGroupName)

GetNumSessions (LUGroupName)

GlobalLock ()

GlobalRelease ()

SetMaxSessions (LUGroupName)

ManageSessions (Command, TargetSessions)

Detailed Function Descriptions


AidButtons(AIDKeys, Options)


AidLinks(AIDKeys, Target, Options)


AidScriptButtons(AIDKeys, Target, Options)


FieldIsBold(offset)


FieldIsBold(row,column)


FieldIsEntry(Offset)


FieldIsEntry(row,column)


FieldIsHidden(offset)


FieldIsHidden(row,column)


FindNextField(offset)


FindNextField(row,column)


FileExists(FullPathandFileName)


FindNextBold(offset)


FindNextBold(Row,Column)


FindNextEntry(Offset)


FindNextEntry(row,column)


FindText Function


GetColor Function

The GetColor function may be used as part of a color customization function, to query the current setting of a color in the active session. Note that the setting for the color can either be of the simple HTML color name text form, or the #336699 form, where the 2 digit hex representation of the Red,Green,Blue components are used.

Use the SetColor Function to change the setting for a given color code for the active session.


GetMaxSessions Function


GetNumSessions Function


GlobalLock Function


GlobalRelease Function


Length Function (also Len Function)


ManageSessions Function


Max Function


Min Function


Modulus Function


Now Function


Screen Function

The Screen Function may be used in any expression, such as in <TESHOW> or <TEIF>.  Screen data will be taken from the current session screen as defined in the function and used "as-is" in a text expression, and converted to an integer or double float value for a numeric expression (depending on that expression's type).

Example:

<TEIF Screen(TargetRow+1,20,5)="Jones">
The list on the screen has <TESHOW Screen(1,10,2)> customers,
and includes the customer Jones.
</TEIF>
The above example checks information on the row below the one referenced by the "TargetRow" variable, at column 20, for 5 characters and compares it to the literal "Jones".

If Jones is found, the data at row 1, column 10 for 2 characters is merged with some simple HTML text to display how many customers are in the list.  This assumes a screen with the number of customers displayed at this position.

Other Examples:

<TESET global.URL="www.mycompany.com">
<TESET row=10+offset*2>
<TESET CustomerName=Screen(row,10,20)>
<TESET Message= '<A HREF="'+global.URL+'">'+Click Here to go There+"</A">

Note in the final example that the apostrophe (single quote) or double-quote character can be used to open and close a literal text value.  Thus, if the literal (such as an HREF tag) requires the use of double quotes, use single-quotes to bracket the literal, as the parser will then ignore the double quotes. 


SetClientCookie Function

The SetClientCookie function is new in ScreenSurfer version 2 and allows you to save a value on the client browser machine. The cookie you define in this function will be sent to the browser on the completion of the current "hit". A cookie is stored on the target machine based on the "domain root" followed by the cookie's name. Cookies are valid on the target machine up until their expiration. The SetClientCookie function defines expiration in terms of number of hours, using a full 32 bit integer (see the HoursToExpiry parameter description, above).

When the DomainRoot you define for the cookie matches the beginning or full URL on either an HREF (in a anchor/link tag) or on the ACTION in a form tag, the cookie value will be sent-in along with the other data in the request.

Cookies may be read in your surferscript using web.Cookie_name, where the name following the web.cookie_ is the name you give here.


SetColor Function

The SetColor function may be used as part of a color customization function, to set the current setting of a color in the active session.

Use the GetColor Function to query the setting for a given color code for the active session.


SetMaxSessions Function

 

TextClean Function

 

TextEncode Function

 

TextLeft Function


TextLower Function


TextMid Function


TextRight Function


TextScreen Function


TextTrim Function


TextUpper Function


WebText Function


Top of Page