Common Scripts and Functions

The scripts have some common functions that are accessible through the Global Host object.

To learn more about the common functions, see the table below:

Subtype Function (HOST object) Input Parameters (Type) Return Type Description
Tracing

WriteTrace()

ByVal msg (String) Boolean Writes a trace log that is useful for debugging in the test bench.
Data
Conversion


MyToString()

ByVal msg (Object)



String

Converts all data to a string and handles nulls and dbnull.

URLEncode()

ByVal msg (String) Encodes the string.

URLDecode()

ByVal msg (String) Decodes the string.
External Data


RunStringRequest()

ByVal url (String)

ByVal username (String)

ByVal password (String)



String

Executes an HTTP Get operation and returns the string result.
RunStringRequest2()

ByVal url (String)

ByVal cookie (String)

ByVal username (String)

ByVal password (String)

Executes an HTTP Get operation and returns the string result.

This function also supports cookie authentication.

RunByteRequest()



Byte()

Executes an HTTP Get operation and returns the binary result.
RunByteRequest()

Executes an HTTP Get operation and returns the binary result.

This function also supports cookie authentication.

Utility
Methods




PersistContentValue()

ByVal key (String)

ByVal value (String)




String

Saves a value during a session.

A session is an enumeration call, item call, or security sync.

GetPersistContentValue() ByVal key (String)

Gets a value during a session that was saved during PersistContentValue.

A session is an enumeration call, an item call, or a security sync.

ResolveMimeType() ByVal mime (String) Resolves a mime type to a file extension.
GetTempFilePath() ByVal extension (String) Gets a temp file name and uses this name for copying the file for indexing.
GetLockableObject()
Object

Gets an object that is global for a content source.

This function can also be used for locking.