Table of Contents

Class ContextContainer

Namespace
PolarStudio
Assembly
PolarStudio.dll

This class provides access to the Context object and supplies various functions that extend the scripting language.

public class ContextContainer
Inheritance
ContextContainer
Inherited Members
Extension Methods

Methods

AddMenuItem(string, string, string, string, string)

This method can only be used during the creation of a scripted menu. It will then create a new menu item the 'current' location.

public void AddMenuItem(string pCaption, string pExplanation = "", string pScriptNameAndParameter = "", string pIconTC = "", string pShortCaptionTC = "")

Parameters

pCaption string

The caption of the menu item

pExplanation string

An optional explanation that can be shown in a mouse-over.

pScriptNameAndParameter string

This parameter sets what to do when the item is selected. It must contain a script expression to fire server-side. It can also be like 'Action;ActionParameter' to fire an action in the browser. Alternatively it can contain an expression like '@JavaScriptExpression'

pIconTC string

The Icon for this menu item

pShortCaptionTC string

A short caption that can be used in your scripts.

BeginMenu(string, string, string, string)

This method can only be used during the creation of a scripted menu. It will then create a new sub-menu at the 'current' location.

public void BeginMenu(string pCaption, string pExplanation = "", string pIconTC = "", string pShortCaptionTC = "")

Parameters

pCaption string

The caption for the sub menu

pExplanation string

An optional explanation that can be shown in a mouse-over.

pIconTC string

An icon (text code) to use.

pShortCaptionTC string

A short caption.

ByteArrayToString(byte[])

This method will create a binary string from the given byte array.

public static string ByteArrayToString(byte[] pByteArray)

Parameters

pByteArray byte[]

An array of bytes

Returns

string

A string with characters that equal the given bytes.

ClearDebug()

This method will clear the Debug panel in Polar Studio.

public void ClearDebug()

ClearQueries()

This method will clear the Queries panel in Polar Studio.

public void ClearQueries()

ClearRequests()

This method will clear the web-requests panel in Polar Studio.

public void ClearRequests()

CompressString(string)

This method will compress a string using the ZLib algorithm.

public static string CompressString(string pInputString)

Parameters

pInputString string

The string to compress. Can contain unicode characters.

Returns

string

A compressed version of the given string. It will be like "@ZLIB:" + InputStringLength + "@" + CompressedData

CreateBarCode(string, string, int, bool, int)

This method creates a string containing the data for a PNG image for a barcode for the given BarCodeText.

public static string CreateBarCode(string pBarCodeText, string pBarCodeType = "", int pHeight = 0, bool pAddText = false, int pBarWidthFactor = 0)

Parameters

pBarCodeText string

The text to create the Barcode form. A * character will be added to be begin/end of the barcode if not yet present.

pBarCodeType string

The type of barcode to create. Use '3of9' or 'code128'. Please use wikipedia for viewing the features of each barcode.

pHeight int

The height in pixels of the barcode.

pAddText bool

A boolean indicating that the text of the barcode is to be added as well.

pBarWidthFactor int

The widht in pixels of a thin bar.

Returns

string

A string containing the binary data for the PNG image for this barcode

CreateINIpasswordKey(string)

This helper creates the slightly encrypted password for a database connection as can be used in PolarServer ini-files. It is better to use integrated security where possible.

public static string CreateINIpasswordKey(string pPassWord)

Parameters

pPassWord string

The database password

Returns

string

A string with the encrypted database password as is used in PolarServer ini files.

CreateQRCode(string, int, int, string)

This method creates a string containing the data for a PNG image for a QR code for the given QRcodeText.

public static string CreateQRCode(string pQRcodeText, int pQRCodeTypeNumber = 0, int pBlockWidthFactor = 0, string pErrorCorrectionLevel = "")

Parameters

pQRcodeText string

The text to create the QR code for

pQRCodeTypeNumber int

The type of QR code to create. This is basically the size. Use values 1-40 or 0 for automatic.

pBlockWidthFactor int

The width/height of a single square.

pErrorCorrectionLevel string

The level of error-correction (L:low / M:medium / Q / H:high )

Returns

string

A string containing the binary data for the PNG image for this QR code

DateToString(object, PolarTimeZone, bool)

This method formats a date to a string that matches the international settings for the user of the current context.

public string DateToString(object pDate, PolarTimeZone pTimeZone = null, bool pForceIncludeSeconds = false)

Parameters

pDate object

The Date to format. Can also be NULL

pTimeZone PolarTimeZone

An optional TimeZone to display the given pDate in. When supplied, the given pDate is treated as a UTC date/time.

pForceIncludeSeconds bool

When a time is given in pDate that has 00 as seconds and seconds are configured to be displayed, then only the HH:mm are shown. The boolean parameter pForceIncludeSeconds can be used to force displaying the seconds in this situation.

Returns

string

A string with the representation of the given date/time in the provided timezone.

DecompressString(string)

This method will take a string that is the result of the CompressString method and decompress it to the original bytes.

public static string DecompressString(string pCompressedInputString)

Parameters

pCompressedInputString string

A string as was the result of CompressString

Returns

string

The original string.

DecryptHex(string, string)

This is a depricated helper to decrypt 16 digit encrypted data (64 bits) with a 16 digit hex key using the outdated des algorithm.

public static string DecryptHex(string pHexCode, string pKey)

Parameters

pHexCode string

16 digit hex containing the encrypted data.

pKey string

A 16 digit hex key used to encrypt the data (although des used only a 56 bits key)

Returns

string

16 digit hex data containing the decrypted result.

DecryptText(string, string)

This method decrypts an encrypted string that was created with the EncryptText method.

public static string DecryptText(string pEncryptedInputText, string pPassWord)

Parameters

pEncryptedInputText string

The string to decrypt.

pPassWord string

The password as was used for encryption.

Returns

string

The decrypted string as was originally passed to EncryptString

EncryptHex(string, string)

This is a depricated helper to encrypt 16 digit data (64 bits) with a 16 digit hex key using the outdated des algorithm.

public static string EncryptHex(string pHexCode, string pKey)

Parameters

pHexCode string

16 digit hex containing the data to encrypt.

pKey string

A 16 digit hex key used to encrypt the data (although des used only a 56 bits key)

Returns

string

A 16 digit hex string containing the encrypted result.

EncryptText(string, string, bool, bool)

This method encrypts a string using the provided symetric password.

public static string EncryptText(string pInputText, string pPassWord, bool pReturnAsHex = false, bool pIsBinaryData = false)

Parameters

pInputText string

The string/data to encrypt

pPassWord string

The password for encryption.

pReturnAsHex bool

If True, the result is a hex-string, when False, it is a binary string

pIsBinaryData bool

This flag can be passed as True when binary data is to be encrypted. This prevents the step from converting unicode to binary which may (in case of binary data) result in incorrect decryption.

Returns

string

The encrypted result in either hex-format (if pReturnAsHex = True) or as binary string.

EndMenu()

This method can only be used during the creation of a scripted menu. It will then end a menu started with BeginMenu.

public void EndMenu()

EscapeStringToJSON(string)

This method converts a string to JSON. No unicode conversions are applied. The result is NOT encapsulated in quotes.

public static string EscapeStringToJSON(string pString)

Parameters

pString string

The string to convert.

Returns

string

The JSON representing the given string.

GetDirectory(string, Mode)

This method returns a PolarFileInfos object that contains the PolarFileInfo objects for all files/folder in a folder

public static PolarFileInfos GetDirectory(string pPathName, PolarFileInfos.Mode pMode = Mode.FilesOnly)

Parameters

pPathName string

The path to retrieve. Can contain wildcards, like 'c:\temp*.png'

pMode PolarFileInfos.Mode

The operation mode: Default = 0 (Files only), FilesOnly = 1, FoldersOnly = 2, FilesAndFolders = 3

Returns

PolarFileInfos

A PolarFileInfos object for the given folder.

GetDirectoryContents(string, int)

This method is for backwards compatibility only. Please use GetDirectory instead.

public static Collection GetDirectoryContents(string pPathName, int pAttributes = 0)

Parameters

pPathName string

The directoty to get

pAttributes int

This parameter is not supported anymore (it is ignored) and is here only for backwards compatibility)

Returns

Collection

A collection of arrays (FileName, DateTime, FileSize (bytes), Attributes). Attibutes: 0=normal; 1=ReadOnly; 2=Hidden; 4=System; 16=Directory; 32=Archive-bit

GetInternetDocument(string)

This method returns a document retrieved over HTTP. No errors will be raised if anything fails.

public static string GetInternetDocument(string pURL)

Parameters

pURL string

The URL of the document to retrieve. The url can start with a specific verb in brackets if wanted, like: (DELETE)https://MyApi.com/?GUID=1234.1234.1234.1234

Returns

string

The contents of the document.

GetInternetDocument(string, ref string, string, Dictionary<string>, Dictionary<string>, int)

This method returns a document retrieved over HTTP.

public static string GetInternetDocument(string pURL, ref string pErrorMessage, string pPostData, Dictionary<string> pHeaders = null, Dictionary<string> pReturnedHeaders = null, int pTimeoutMs = 0)

Parameters

pURL string

The URL of the document to retrieve. The url can start with a specific verb in brackets if wanted, like: (DELETE)https://MyApi.com/?GUID=1234.1234.1234.1234

pErrorMessage string

A by-ref parameter that will contain an error message if applicable.

pPostData string

A string containing the Post-data. If provided, a POST will be executed instead of a GET.

pHeaders Dictionary<string>

If wanted, additional HTTP headers can be added to the request in this string parameter. Each header is like: HeaderName=HeaderValue. Headers must be on separate lines.

pReturnedHeaders Dictionary<string>

This by-ref parameter will be filled with the returned HTTP headers of the response. Each header is on a separate line in the format: HeaderName=HeaderValue

pTimeoutMs int

The time (in miliseconds) to wait for a timeout. A value of 0 means wait infinitely.

Returns

string

The contents of the document.

GetInternetDocument(string, ref string, string, int)

This method returns a document retrieved over HTTP.

public static string GetInternetDocument(string pURL, ref string pErrorMessage, string pPostData = "", int pTimeoutMs = 0)

Parameters

pURL string

The URL of the document to retrieve. The url can start with a specific verb in brackets if wanted, like: (DELETE)https://MyApi.com/?GUID=1234.1234.1234.1234

pErrorMessage string

A by-ref parameter that will contain an error message if applicable.

pPostData string

A string containing the Post-data. If provided, a POST will be executed instead of a GET.

pTimeoutMs int

The time (in miliseconds) to wait for a timeout. A value of 0 means wait infinitely.

Returns

string

The contents of the document.

GetInternetDocument(string, ref string, string, string, ref string, ref string, int)

This method returns a document retrieved over HTTP.

public static string GetInternetDocument(string pURL, ref string pErrorMessage, string pPostData, string pHeaders, ref string pReturnedHeaders, ref string pContentType_InOut, int pTimeoutMs = 0)

Parameters

pURL string

The URL of the document to retrieve. The url can start with a specific verb in brackets if wanted, like: (DELETE)https://MyApi.com/?GUID=1234.1234.1234.1234

pErrorMessage string

A by-ref parameter that will contain an error message if applicable.

pPostData string

A string containing the Post-data. If provided, a POST will be executed instead of a GET.

pHeaders string

If wanted, additional HTTP headers can be added to the request in this string parameter. Each header is like: HeaderName=HeaderValue. Headers must be on separate lines.

pReturnedHeaders string

This by-ref parameter will be filled with the returned HTTP headers of the response. Each header is on a separate line in the format: HeaderName=HeaderValue

pContentType_InOut string

If this parameter is provided, the content-type of the request will be set to this value. The returned by-ref value will be updated to the content-type of the response.

pTimeoutMs int

The time (in miliseconds) to wait for a timeout. A value of 0 means wait infinitely.

Returns

string

The contents of the document.

GetPerformanceCounter()

Returns the current value for the Performance counter. To determine how long an action takes, do as follows: lStartCounter = GetPerformanceCounter 'Do your actions SendDebug "This took " & ((GetPerformanceCounter - lStartCounter) / GetPerformanceCounterFrequency) & " seconds to run"

public static long GetPerformanceCounter()

Returns

long

GetPerformanceCounterFrequency()

Returns the number of 'counts' for one second as is used for GetPerformanceCounter.

public static long GetPerformanceCounterFrequency()

Returns

long

10000000

HexToString(string)

This method converts a hex string to a binary string with characters representing the hex data.

public static string HexToString(string pInputHexString)

Parameters

pInputHexString string

The hex data

Returns

string

A binary string

JSONstringToDateTime(string)

This helper is used to convert a JSON string to DateTime. JSON has no formal support for date/time values. The ValueToJSON method will convert Date variables to a string formatted 'yyyy-MM-ddTHH:mm:ss'

public static DateTime JSONstringToDateTime(string pJSONvalue)

Parameters

pJSONvalue string

A string representing a date time.

Returns

DateTime

The date/time.

NewChart()

This method returns a new PolarChart object

public static Chart NewChart()

Returns

Chart

A PolarChart object

NewCustomForm()

This method returns a new CustomForm object.

public static CustomForm NewCustomForm()

Returns

CustomForm

A new CustomForm object.

NewImage()

This method returns a new Image object for simple image functions with default properties.

public static Image NewImage()

Returns

Image

A new Image object

NewImage(int, int, int)

This method returns a new Image object for simple image functions.

public static Image NewImage(int pWidth, int pHeight, int pBackgroundColor = 16777215)

Parameters

pWidth int

The width of the image in pixels

pHeight int

The height of the image in pixels

pBackgroundColor int

The color of the background. You can use constants (like vbBlack, vbWhite, etc) or the RGB function.

Returns

Image

NewPolarXMLdocument()

This method returns a new PolarXMLdocument. The PolarXMLdocument is a wrapper that allows code written for the Microsoft XML objects to work.

public static PolarXMLdocument NewPolarXMLdocument()

Returns

PolarXMLdocument

A new PolarXMLdocument.

NewStringDictionary()

This method returns a new dictionary object that is typed to only contain strings.

public static Dictionary<string> NewStringDictionary()

Returns

Dictionary<string>

A string-dictionary

NumberToString(double, int, bool)

This method formats a number to a string that matches the international settings for the user of the current context

public string NumberToString(double pNumber, int pDecimals = -1, bool pThousandsSeparators = false)

Parameters

pNumber double

The Number to format. Can also be NULL

pDecimals int

This parameter specifies the number of decimals to show. Use -1 to show the actual number of decimals contained in the passed number.

pThousandsSeparators bool

This boolean parameter specifies if each set of 3 digits (the thousands) should be separated.

Returns

string

A string representing the number given the provided number of decimals and the pThousandSeparators

OneTimePasswordHelper(string)

The method returns a OneTimePasswordHelper as can be used to validate one time passwords (TOTP) as created with authenticator apps

public static OneTimePassword OneTimePasswordHelper(string pKey = "")

Parameters

pKey string

The key to use for this OneTimePassword. If no key is provided, a new random key is used.

Returns

OneTimePassword

A OneTimePassword object.

ParseJSON(string)

This method converts a unicode JSON string to objects. JSON arrays are returned as collections, JSON objects are returned as case-sensitive dictionaries. If parsing fails, Nothing will be returned, but no error will be raised.

public static object ParseJSON(string pJSONstring)

Parameters

pJSONstring string

A valid JSON string

Returns

object

A collection or dictionary object, depending on the JSON input.

ParseJSON(string, ref string)

This method converts a unicode JSON string to objects. JSON arrays are returned as collections, JSON objects are returned as case-sensitive dictionaries. If parsing fails, the by-ref parameter pErrorMessage will contain the error message.

public static object ParseJSON(string pJSONstring, ref string pError)

Parameters

pJSONstring string

A valid JSON string

pError string

This by-ref parameter will be filled with the parsing-error if applicable.

Returns

object

A collection or dictionary object, depending on the JSON input.

RemoveUnicodeCharactersFromString(string, string)

This method take a string and removes all unicode characters (characters that are not in the standard character set) by the given replacement character.

public static string RemoveUnicodeCharactersFromString(string pInputString, string pReplacementCharacter = "")

Parameters

pInputString string

The string to sanitize

pReplacementCharacter string

The character that will replace the unicode characters

Returns

string

A string without unicode characters.

ReplaceParameters(string, params object[])

This method parses the given pInputText and replaces [%1], [%2] etc for the given parameters in pParametersArray.

public static string ReplaceParameters(string pInputText, params object[] pParametersArray)

Parameters

pInputText string

The string to process.

pParametersArray object[]

The parameters for position 1, 2, 3, etc.

Returns

string

ReplaceSqlParameters(Context, string, params object[])

This method parses the given SQL in pInputText and replaces [%1], [%2] etc for the given parameters in pParametersArray formatted as SQL.

public static string ReplaceSqlParameters(Context pContext, string pInputText, params object[] pParametersArray)

Parameters

pContext Context

The context to use.

pInputText string

The SQL formatted string to process.

pParametersArray object[]

The parameters for position 1, 2, 3, etc.

Returns

string

A SQL string with the given [%1] etc replaced by the SQL representations of the given elements in pParametersArray

ReplaceSqlParameters(DataConnector, string, params object[])

This method parses the given SQL in pInputText and replaces [%1], [%2] etc for the given parameters in pParametersArray formatted as SQL.

public static string ReplaceSqlParameters(DataConnector pDataConnector, string pInputText, params object[] pParametersArray)

Parameters

pDataConnector DataConnector

The dataconnector to use for converting the values to SQL strings.

pInputText string

The SQL formatted string to process.

pParametersArray object[]

The parameters for position 1, 2, 3, etc.

Returns

string

A SQL string with the given [%1] etc replaced by the SQL representations of the given elements in pParametersArray

ReplaceSqlParameters(string, params object[])

This method parses the given SQL in pInputText and replaces [%1], [%2] etc for the given parameters in pParametersArray formatted as SQL.

public string ReplaceSqlParameters(string pInputText, params object[] pParametersArray)

Parameters

pInputText string

The SQL formatted string to process.

pParametersArray object[]

The parameters for position 1, 2, 3, etc.

Returns

string

A SQL string with the given [%1] etc replaced by the SQL representations of the given elements in pParametersArray

ReportChart()

This method can be access during the creation of the chart in a report. It can be used to do custom styling etc.

public object ReportChart()

Returns

object

A reference to the chart that is being created.

ReportField(string, object)

This method can be access during the creation of reports only and will contain the value of the field with the given name.

public object ReportField(string pFieldName, object pDefaultValue = null)

Parameters

pFieldName string

The name of the field which value is to be retrieved or one of the following pseudo-fields: '%TotalsLevel' (0/1/2) '%AlternatingRow' (True/False), '%RowCount', '%SubRowCount', '%Name'/'%ReportName', '%Caption'/'%ReportCaption', '%Description'/'%ReportDescription', '%GroupIdentifier'

pDefaultValue object

The value to use when it is NULL

Returns

object

The value of the requested field.

SendDebug(params object[])

This method sends the given parameters to the debug window in Polar Studio. After the line a linefeed is added.

public void SendDebug(params object[] pItems)

Parameters

pItems object[]

The items to display in the debug window

SendDebugNoLF(params object[])

This method sends the given parameters to the debug panel in Polar Studio. There will be no linefeed added to the line, allowing multiple elements to be printed on one line.

public void SendDebugNoLF(params object[] pItems)

Parameters

pItems object[]

The items to display in the debug window

SendMessage(string, bool, string, string, string, string, string, string, string, object, string, Context)

This method sends a message to a user that is shown in a popup in the browser.

public void SendMessage(string pMessage, bool pMessageIsHtmlFormatted = false, string pCaption = "", string pIconURL = "", string pOnOkScript = "", string pOnCancelScript = "", string pOkButtonCaption = "", string pCancelButtonCaption = "", string pStyle = "", object pReverseButtons = null, string pOnCloseScript = "", Context pContext = null)

Parameters

pMessage string

The message to send to the user.

pMessageIsHtmlFormatted bool

A boolean parameter indicating the passed message contains HTML. Only pass as true if your own code makes sure al variable data is converted to HTML.

pCaption string

An optional caption for the caption of the popup dialog

pIconURL string

The URL to use for the icon that is shown in the popup.

pOnOkScript string

The script-expression to execute server side when the users clicks the OK button. The expression can be preceeded by an exclamation-mark to run the given script-expression 'interactively'. When an expression is given that starts with a @, this expression is fired as javascript in the browser.

pOnCancelScript string

The Cancel button will be hidden if this parameter is empty. Use only a minus character to show the cancel button but to take no action. Else, this paramater contains the script-expression to execute server side when the users clicks the OK button. The expression can be preceeded by an exclamation-mark to run the given script-expression 'interactively'. When an expression is given that starts with a @, this expression is fired as javascript in the browser.

pOkButtonCaption string

The caption of the OK button if it should be differen than OK. Specify as '---' (3x minus) to completely hide the OK button.

pCancelButtonCaption string

The caption of the Cancel button if it should be differen than Cancel.

pStyle string

A css-class that is applied to the elements in the Popup and that can be used to style popups using your custom CSS.

pReverseButtons object

A boolean parameter to indicate that the OK and Cancel buttons must trade places (thus Cancel / OK)

pOnCloseScript string

The Close-cross button in the top-right corner of the dialog will be hidden if this parameter is empty. Use only a minus character to show the close button but to take no action. Else, this paramater contains the script-expression to execute server side when the users clicks the OK button. The expression can be preceeded by an exclamation-mark to run the given script-expression 'interactively'. When an expression is given that starts with a @, this expression is fired as javascript in the browser.

pContext Context

A context to run the actions in. Especially important in multiple document interface applications.

StringHasUnicodeCharacters(string)

This boolean returns True if the given string contains characters that are not in the standard character set.

public static bool StringHasUnicodeCharacters(string pInputString)

Parameters

pInputString string

The string to test for unicode characters.

Returns

bool

True if the given string contains unicode characters.

StringToByteArray(string)

This method will create a byte-array from the given binary string. Unicode characters will not (correctly) be converted.

public static byte[] StringToByteArray(string pString)

Parameters

pString string

The string to convert to a byte-array.

Returns

byte[]

A byte array representing the given string.

StringToDate(string, PolarTimeZone)

This method takes a string and converts it to a data/time. It uses the international settings for the user of the current context. It also accepts expressions as '*' for today, '**' for now, '-3y' etc. An error will be raised if the conversion failed.

public DateTime StringToDate(string pInputString, PolarTimeZone pTimeZone = null)

Parameters

pInputString string

The string to convert to a date

pTimeZone PolarTimeZone

If a timezone is given, the given string is expected to be a local time in the given timezone and it is converted to a UTC date/time value.

Returns

DateTime

A date/time value

StringToDate(string, ref string, PolarTimeZone)

This method takes a string and converts it to a data/time. It uses the international settings for the user of the current context. It also accepts expressions as '*' for today, '**' for now, '-3y' etc.

public DateTime StringToDate(string pInputString, ref string pErrorMessage, PolarTimeZone pTimeZone = null)

Parameters

pInputString string

The string to convert to a date

pErrorMessage string

This ByRef parameter contains an error message if the conversion failed.

pTimeZone PolarTimeZone

If a timezone is given, the given string is expected to be a local time in the given timezone and it is converted to a UTC date/time value.

Returns

DateTime

A date/time value

StringToHex(string)

This method converts a binary string to hex. No conversion from unicode is made.

public static string StringToHex(string pInputString)

Parameters

pInputString string

A binary string

Returns

string

The hex code representing the given binary string.

StringToNumber(string)

This method takes a string and converts it to a number. It uses the international settings for the user of the current context. It will allways return a number and no error will be raised.

public double StringToNumber(string pInputString)

Parameters

pInputString string

The local string to convert to a number

Returns

double

A double number.

SysDebug(string)

This method sends a message to the server console. These messages are not visible in PolarStudio in any way. Meant for internal use.

public static void SysDebug(string pMessage)

Parameters

pMessage string

The message to send to the console.

ValueToJSON(object)

This method converts any value to JSON. This method can be called with standard variable types, collections and dictionaries. No unicode conversions are applied to strings, thus the result will be a unicode string. If this string is stored or sent out in a non-unicode way, a UnicodeToUTF8 must be applied on this result.

public static string ValueToJSON(object pValue)

Parameters

pValue object

The value to convert to JSON

Returns

string

A JSON string.

ValueToString(object)

This method take any object and converts it to a string as is used for the debugging Windows. Strings are returned as string, numbers are returned in technical format (decimal dot), dates in local format. Booleans as True/False, Nothing as [Nothing] and other objects as '[ObjectType]'.

public string ValueToString(object pValue)

Parameters

pValue object

Returns

string

WriteLogLine(string, string, bool)

This method writes a line of text to a log (a text-file in the file-system)

public void WriteLogLine(string pLogMessage, string pFileName = "", bool pDoNotAddDateTime = false)

Parameters

pLogMessage string

The line of text to add to the log.

pFileName string

The name of the file to write to. Will be 'LogResults.txt' if left empty. If the file does not exists, it will be created.

pDoNotAddDateTime bool

By default, each line is preceeded by a date/time stamp, unless this parameter is passed as True.