LitDev Extension API

LD3DView LDArray LDBits LDBlueTooth LDCall
LDChart LDClient LDClipboard LDColours LDCommPort
LDController LDControls LDCursors LDDataBase LDDateTime
LDDebug LDDialogs LDDictionary LDEffect LDEmail
LDEncryption LDEvents LDFastArray LDFastShapes LDFigures
LDFile LDFocus LDftp LDGraph LDGraphicsWindow
LDHID LDImage LDInline LDIOWarrior LDList
LDLogic LDMath LDMathX LDMatrix LDMusic
LDNetwork LDPhysics LDProcess LDQueue LDRegex
LDResources LDScrollBars LDSearch LDServer LDSettings
LDShapes LDShell LDSort LDSound LDSpeech
LDStatistics LDStopwatch LDText LDTextWindow LDTimer
LDTranslate LDUnits LDUtilities LDWaveForm LDWebCam
LDWindows LDxml LDZip

LDFile
File utilities.

AccessTime ANSItoUTF8 AppDataFolder
CopyDirectory CreationTime CSVplaceholder
DocumentsFolder Exists GetAllDirectories
GetExtension GetFile GetFolder
Length LoadAllVariables ModifiedTime
MusicFolder PicturesFolder PrintFile
PublicFolder ReadANSI ReadANSIToArray
ReadCSV ReadCSVTransposed ReadToArray
RenameDirectory RenameFile SaveAllVariables
Size TempFolder UserName
WriteCSV

AccessTime(fileName)
Gets the last time a file was accessed.
fileName The full path of the file.
returns The last access time of the file or directory ("" on failure).

ANSItoUTF8(fileName,BOM)
Convert an ANSI encoded text file to UTF8.
It should also work for any other encoding.
UTF8 is the default text file encoding used by Small Basic.

fileName The file path to convert.
BOM Include Byte Order Mark (BOM) in UTF8 file ("True" or "False", no BOM is usual).
returns The converted file path (-UTF8.txt) or "" for failure (the encoding may not have been detected correctly).

AppDataFolder
Gets the ApplicationData folder path.

CopyDirectory(directoryFrom,directoryTo)
Recursively copy a directory and all contents including sub-directories.
directoryFrom The full path to the directory to copy from.
directoryTo The full path to the directory to copy to.
returns "SUCCESS" or "FAILED".

CreationTime(fileName)
Gets the creation time of a file.
fileName The full path of the file.
returns The creation time of the file or directory ("" on failure).

CSVplaceholder
Character to use in place of empty values in the imported array when reading CSV files.
A SmallBasic array cannot hold an empty value i.e. "".

Default is the empty string "" (no array entries created for empty values in the CSV file).


DocumentsFolder
Gets the Documents folder path.

Exists(fileName)
Check if a file path is an existing file or directory.
fileName The full path of the file or directory.
returns "True" or "False".

GetAllDirectories(path)
Recursively get all sub-directories in directory.
path The full path to the root dircetory.
returns An array of all sub-directories or "FAILED".

GetExtension(fileName)
Get the file extension for a file.
fileName The file name with extension (may include folder path or not).
returns The extension of the file (without the '.') or "" if no extension.

GetFile(fileName)
Get the file for a full file path.
fileName The full path of a file.
returns The file name part of the file path (without the folder or the extension).

GetFolder(fileName)
Get the folder for a full file path.
fileName The full path of a file.
returns The folder part of the file path.

Length(fileName)
Gets the number of lines in a text file.
fileName The full path of the file.
returns The number of lines in the file (-1 on failure).

LoadAllVariables(fileName)
Restore the values of all variables that were previously stored using SaveAllVariables.
fileName The full path to a file with stored variable values.

ModifiedTime(fileName)
Gets the last time a file was modified.
fileName The full path of the file.
returns The last modified time of the file or directory ("" on failure).

MusicFolder
Gets the Music folder path.

PicturesFolder
Gets the Pictures folder path.

PrintFile(fileName)
Print a file.
fileName The full path of the file to print.

PublicFolder
Gets the Public folder path.

ReadANSI(fileName)
Read an ANSI encoded text file.
It should also work for any other encoding including UTF8.
UTF8 is the default text file encoding used by Small Basic.

fileName The file path to read.
returns The contents of the file or "" for failure (the encoding may not have been detected correctly).

ReadANSIToArray(fileName)
Reads a text file with ANSI encoding into an array with one element for each line in the file.
It should also work for any other encoding including UTF8.
Blank lines are included as an element in the array with one blank space.

fileName The full path of the file.
returns An array with one element for each line in the file or "" for failure (the encoding may not have been detected correctly).

ReadCSV(fileName)
Read a CSV (comma separated values) file into an array.
The deliminator may be changed from a comma using Utilities.CSVDeliminator

fileName The full path of the CSV file.
returns A 2D array with CSV file imported.

ReadCSVTransposed(fileName)
Read a CSV (comma separated values) file into an array. and transpose (swap rows and columns).
The deliminator may be changed from a comma using Utilities.CSVDeliminator

fileName The full path of the CSV file.
returns 2D array with transposed CSV file imported.

ReadToArray(fileName)
Reads a text file into an array with one element for each line in the file.

Blank lines are included as an element in the array with one blank space.

fileName The full path of the file.
returns An array with one element for each line in the file.

RenameDirectory(directoryFrom,directoryTo)
Rename or move a directory.
directoryFrom The full path to the directory to rename.
directoryTo The full path to the new name for the directory.
returns "SUCCESS" or "FAILED".

RenameFile(fileFrom,fileTo)
Rename or move a file.
fileFrom The full path to the file to rename.
fileTo The full path to the new name for the file.
returns "SUCCESS" or "FAILED".

SaveAllVariables(fileName)
Save all of the current variables to a file.
This is the complete current state of your program.
May be useful to store a game state, or for debugging.

fileName The full path to store the variables and their values.
This file will be over-written.


Size(fileName)
Get the size of a file in bytes.
fileName The full path to the file to get the size of.
returns The number of bytes in the file or -1 on error.

TempFolder
Gets the Temp folder path.

UserName
Gets the current user name.

WriteCSV(fileName,array)
Write a 2D array to a CSV (comma separated values) file.
The deliminator may be changed from a comma using Utilities.CSVDeliminator

fileName The full path of the CSV file.
array The array to export.
returns None.