Routines for c_fsvcs.kb


AppendTextToFile

File Name

c_fsvcs.kb

Syntax

AppendTextToFile(VAL text: STRING, VAL path: STRING)

Parameters

text - text to be appended to file

path - path of file text

Returns

Nothing

Side Effects

None

Description

This procedure appends text to a specified file.

Dialog Forms Called

None


CheckExt

File Name

c_fsvcs.kb

Syntax

CheckExt(REF Root: STRING, VAL Ext: STRING )

Parameters

Root - file name

Ext - extension for file

Returns

Root

Side Effects

None

Description

Appends an extension to the file if there is none.

Dialog Forms Called

None


CsvToTokens

File Name

c_fsvcs.kb

Syntax

CsvToTokens(REF tokens: LIST OF STRING, VAL csv: STRING, VAL delim: STRING)

Parameters

tokens - list of tokens

csv - CSV file

delim - delimiter separator

Returns

Tokens

Side Effects

None

Description

CSV separates strings and inserts them into tokens, as a list of string. It separates the items in the string by looking for the delimiter.

Dialog Forms Called

None


DirtyPath

File Name

c_fsvcs.kb

Syntax

DirtyPath(REF Path: STRING)

Parameters

Path - string to clean

Returns

None

Side Effects

None

Description

Adds trailing blackslash '\' (or '/') to path depending on the operating system.

Dialog Forms Called

None


EndsIn

File Name

c_fsvcs.kb

Syntax

EndsIn(s,pattern): BOOLEAN

Parameters

s - source string

pattern - substring

Returns

TRUE or FALSE

Side Effects

None

Description

This function determines if the source string has the pattern string as its last characters. If so, it returns TRUE, otherwise, FALSE. For example, this function is used to determine if a function has () at the end.

Dialog Forms Called

None


ExplodeToken

File Name

c_fsvcs.kb

Syntax

ExplodeToken(REF outToken: STRING, VAL inToken: STRING)

Parameters

outToken - new token

inToken - original token

Returns

outToken

Side Effects

None

Description

This function formats a token with special characters.

Dialog Forms Called

None


FilterHypertext

File Name

c_fsvcs.kb

Syntax

FilterHypertext( VAL str:STRING ): STRING

Parameters

str (O) - string content

Returns

The modified input string

Side Effects

None

Description

This function scans a string for embedded hypertext flags and replaces them with the button name in single brackets [].

Dialog Forms Called

None


FindSAIAppPath

File Name

c_fsvcs.kb

Syntax

FindSAIAppPath(VAL app: STRING): STRING

Parameters

app - the directory name

Returns

The directory where the application is installed

Side Effects

None

Description

This function goes through saipath and finds the directory where the application is installed.

Dialog Forms Called

None


FlattenToken

File Name

c_fsvcs.kb

Syntax

FlattenToken(REF outToken: STRING, VAL inToken: STRING)

Parameters

outToken - new token

inToken - original token

Returns

outToken - 1 if successful , 0 if failure

Side Effects

None

Description

This function flattens a token.

Dialog Forms Called

None


FormatTableDataAsCSV

File Name

c_fsvcs.kb

Syntax

FormatTableDataAsCSV(VAL TableName:STRING, REF listOfCSV_Rows: LIST OF STRING, VAL delim: STRING, VAL w: WINDOW, VAL visorg: LIST OF STRING)

Parameters

Table - name of table to format

listOfCSV_Rows - list of comma-separated values for all records in the table

delim - desired delimeter

Returns

listOfCSV_Rows

Side Effects

None

Description

This procedure accepts a table name, determines the columns that exist in that table, and then formats all data in the table as comma-separated value format (CSV). This procedure acccepts a delimter used to separate the values These will not necessarily be commas. This procedure formats the following header information for the table:

TABLE_IDENTIFIER [ <Table name>
COLUMN_IDENTIFIER ( <Column names as CSV>
DATA_TYPE_IDENTIFIER { <Data types as CSV>

Dialog Forms Called

None


GetFileExt

File Name

c_fsvcs.kb

Syntax

GetFileExt( VAL filename: STRING ): STRING

Parameters

fileName - a file

Returns

The file extension

Side Effects

None

Description

This function takes in the entire file name, breaks it down, and returns the file name.

Dialog Forms Called

None


GetFileName

File Name

c_fsvcs.kb

Syntax

GetFileName(efile,extension)

Parameters

efile - the directory and name of the file

extension - the extension of the file that will be removed

Returns

The file name without the extension and directory path

Side Effects

None

Description

This function strips off the extension and directory path and returns the file name only. For instance, if efile is 'c:\sai\esmicons\freeze.bmp' and extension is '.bmp', the function returns 'freeze'.

Dialog Forms Called

None


ReadTextFromFile

File Name

c_fsvcs.kb

Syntax

ReadTextFromFile(VAL w: WINDOW, REF TextList: LIST OF STRING, VAL path: STRING)

Parameters

w - window handle

TextList - text to be read from file

path - path of file text to be read

Returns

TextList

Side Effects

None

Description

This procedure reads the text in a specified file.

Dialog Forms Called

None


RunByAssociation

File Name

c_fsvcs.kb

Syntax

RunByAssociation( VAL w: WINDOW, VAL op: STRING, VAL docFile: STRING, VAL param: STRING, VAL startDir: STRING, VAL showOp: INTEGER ): INTEGER

Parameters

w - window handle of parent

op - operation to perform. Choose from: 'open', 'print', 'explore'

docFile - executable or document file to run

param - command line parameters to pass to docFile

startDir - startup directory

showOp - startup mode of application. Choose from:

SW_HIDE, SW_MAXIMIZE, SW_MINIMIZE, SW_RESTORE, SW_SHOW,

SW_SHOWDEFAULT, SW_SHOWMAXIMIZED, SW_SHOWMINIMIZED,

SW_SHOWMINNOACTIVE, SW_SHOWNA, SW_SHOWNOACTIVATE, SW_SHOWNORMAL

Returns

0, if success

Or returns one of the following on failure:

ERROR_FILE_NOT_FOUND

ERROR_PATH_NOT_FOUND

ERROR_BAD_FORMAT

SE_ERR_ACCESSDENIED

SE_ERR_ASSOCINCOMPLETE

E_ERR_DDEBUSY

SE_ERR_DDEFAIL

SE_ERR_DDETIMEOUT

SE_ERR_DLLNOTFOUND

SE_ERR_FNF

SE_ERR_NOASSOC

SE_ERR_OOM

SE_ERR_PNF

SE_ERR_SHARE

ERROR_NOT_WINDOWS

ERROR_UNKNOWN_FILE

Side Effects

None

Description

This calls ShellExecute from the Windows SHELL.DLL.

Dialog Forms Called

None


S_BuildEVPath

File Name

c_fsvcs.kb

Syntax

S_BuildEVPath(VAL pathIn: STRING): STRING

Parameters

pathIn - path name with embedded environment variable

Returns

Path name with EV substituted

Side Effects

None

Description

This function takes a file path and searches for an environment A variable is denoted within {}. It then searches and builds the correct path. If the environment variable is not found, it returns the path.

Dialog Forms Called

None


StripWord

File Name

c_fsvcs.kb

Syntax

StripWord(filename,word): STRING

Parameters

filename - a string

word - a string

Returns

The file name minus the word

Side Effects

None

Description

This function finds the position of the word in a file name and returns the beginning of the file name to the position of the word. For instance, if the file name is 'xxx.bmp' and the word is '.bmp', the function returns 'xxx'.

Dialog Forms Called

None


TokenizeCsvData

File Name

c_fsvcs.kb

Syntax

TokenizeCsvData(REF csvData: LIST OF STRING, VAL delim: STRING)

Parameters

csvData - a string separted by the delimeter

delim - the item that separates the strings in csvData

Returns

tokenized csvData

Side Effects

None

Description

CSV separates the strings and inserts them into an array of list of string. It separates the items in the string by looking for the delimeter.

Dialog Forms Called

None


TokensToCsv

File Name

c_fsvcs.kb

Syntax

TokensToCsv(VAL tokens: LIST OF STRING, VAL delim: STRING)

Parameters

tokens - objects in a list

delim - a delimeter for the result string

Returns

outToken - all of the tokens in a string separated by the delimeter

Side Effects

None

Description

This function finds the tokens and formats them into a string separated by the delimeter

Dialog Forms Called

None


WriteListOfTextToFile

File Name

c_fsvcs.kb

Syntax

WriteListOfTextToFile(VAL w: WINDOW, VAL TextList: LIST OF STRING, VAL path: STRING)

Parameters

w - window handle

TextList - text to be written to file

path - path of file to which text is written

Returns

Nothing

Side Effects

None

Description

This procedure uses a list of text and writes the list to the specified file.

Dialog Forms Called

None