DWS File Library

Top  Previous  Next  Contents  Index 

The following file functions are supported in DWS scripts.  Most are standard DWS file functions, while some were added by Ascendis Software LLC:

 

procedure AppendStringToFile(<string filename>, <string string>);

writes specified string to end of specified file, retaining any existing contents

 

function ChangeFileExt(<string filename>, <string extension>): String;

returns <filename> with <extension> instead of the existing extension
does not rename the filefunction FileExists(<string filename>): Boolean;
returns True if file specified by <filename> exits, else False

 

procedure ChDir(<string path>);

changes current directory to <path>
only affects this process
if <path> includes a drive letter, the current drive is also changed

 

function CreateDir(<string path>): Boolean;

creates directory specified by <path> and returns True, else returns False

 

function DeleteFile(<string filename>): Boolean;

deletes file specified by <filename> and returns True, else returns False

 

function ExtractFileDir(<string path>): String;

returns the folder portion of <path>
if <path> contains no drive or directory parts, an empty string is returned

 

function ExtractFileDrive(<string path>): String;

returns the drive portion of <path>
if <path> does not contain a drive specification, an empty string is returned

 

function ExtractFileExt(<string path>): String;

returns the rightmost period and all following characters from <path>
if <path> contains no extension, an empty string is returned
note that ExtractFileExt('foobar.sql.txt') returns '.txt', not '.sql.txt'

 

function ExtractFileName(<string path>): String;

returns file name portion of <path>
if <path> contains no drive or directory parts, returns <path>

 

function ExtractFilePath(<string path>): String;

returns the drive and directory portions of <path>
if <path> contains no drive or directory parts, an empty string is returned

 

function FileExists(<string path>): Boolean;

returns True if file specified by <path> exists, else returns False

 

function FileSearch(<string name>, <string dirList>): String;

looks for <name> in directories named in <dirList> and returns fully qualified pathname to it, or an empty string
separate directories in <dirList> with semicolons

 

function GetAppFolder: String;

returns fully qualified path of folder containing Ascendis Caller ID

 

function GetCurrentDir: String;

returns fully qualified path of current directory

 

function GetDataFolder: String;

returns fully qualified path of program data folder
folder contains database folder and, unless otherwise configured, log files

 

function GetTempPath: String;

returns fully qualified path of temp folder

 

function LoadStringFromFile(<string filename>): String;

returns contents of specified file as a string

 

function RemoveDir(<string path>): Boolean;

removes directory specified by <path> and returns True, else returns False
the directory must be empty or RemoveDir will fail

 

function RenameFile(<string oldFilename>, <string newFilename>): Boolean;

renames file specified by <oldFilename> to <newFilename> and returns True, else returns False

 

procedure SaveStringToFile(<string filename>, <string string>);

writes specified string to specified file, overwriting any existing contents

 

function SetCurrentDir(<string path>): Boolean;

changes current directory to specified path and returns True, else returns False