File Functions


FILE_ISEXISTED

Returns TRUE if the file or folder does exist.

string FILE_ISEXISTED( filename )

FILE_DATE

Gets the date of a file.

datetime FILE_DATE( filename[, type = 0 ] )

The parameter type can be one of the following:

  • 0 -- Create date and time
  • 1 -- Last write date and time
  • 2 -- Last access date and time

FILE_SIZE

Gets the size of a file.

number FILE_SIZE( filename )

FILE_PATH

Gets the path from a full path filename.

string FILE_PATH( filename )

%=FILE_PATH( @"c:\\document\\abc.log")% Returns then extension "c:\\document\\"

FILE_NAME

Gets the name from a full path filename.

string FILE_NAME( filename )

%=FILE_NAME( @"c:\\abc.log")% Returns then extension "abc.log"

FILE_EXT

Gets the extension name within a full path filename.

string FILE_EXT( filename )

Examples

%=FILE_EXT( @"c:\\abc.log")% Returns then extension "log"

FILE_TEMPNAME

Returns a name for a temporary file.

string FILE_TEMPNAME( [prefix_string],[bool_contain_path] )

Note: The function uses up to the first three characters of this string as the prefix of the file name. The default value of the optional parameter bool_contain_path is FALSE.

  • %=FILE_TEMPNAME()% Returns "123123.tmp"
  • %=FILE_TEMPNAME( "abc" )% Returns "abc3123.tmp"
  • %=FILE_TEMPNAME( "abc", true )% Returns "c:\users\john\appdata\local\temp\abc3123.tmp"

FILE_PICK

Retrieves a filename from a folder.

string FILE_PICK( filename(wildchar is allowed)[, is_folder_allowed][, index] )

The parameter index is zero-based.

  • %=FILE_PICK( 'c:\\*.jpg', FALSE, 2 )% Returnss the name of the third JPG file.
  • %=FILE_PICK( "c:\\abc.jpg" )% Returnss the abc.jpg if the file is existed, otherwise, returns an empty string.

FILE_COUNT

Counts files of certain type in a folder.

number FILE_COUNT( filename(wildchar is allowed) [, search_for_subfolders = FALSE ] [,is_folder_allowed = FALSE ] )

Parameters

Filename Specifies a folder, and the file name. The file name can include wildcard characters, for example, an asterisk (*) or a question mark (?), and multiple items are allowed and should be separated by the colon-characeter ;. For example, "C:\WINDOWS\*.BMP;*.JPG;*.GIF", "C:\WINDOWS\*.EXE;*.DLL;*.OCX".

search_for_subfolders Optionally, specifies wether sub-folders are to be searched, if TRUE, all sub-folders in the folder will be scaned.

is_folder_allowed Optionally, specifies wether the folder is to be counted. If FALSE, only file will be counted.

Examples

  • %=FILE_COUNT( 'c:\\*.jpg;*.bmp', FALSE, FALSE )% Returnss the number of JPG and BMP files in the root folder of C.
  • %=FILE_COUNT( @"c:\\temp\\abc.jpg", TRUE )% Returnss the number of abc.jpg in the fodler c:\temp and its sub-folders.

IMG_RES

Gets the width or height of an image file.

IMG_RES( filename [, what = 0 ] )

The parameter what can be one of the follow:

  • 0 (Default value) -- Retrieves a string to represent the size in the format width x height. For example: 100x200
  • 1 -- Retrieves the number value of the width of the image.
  • 2 -- Retrieves the number value of the height of the image.

%=IMG_RES( @"c:\\abc.jpg")% Returns a string "100x200"
%=IMG_RES( @"c:\\abc.jpg", 1)% Returns the number 100

IMG_LOAD

Loads an image file and returns a binary data. This function can be used in the action "Input dialog" to show an image, and also be used in the built-in function "BASE64_ENCODE" to base64 an image

binary IMG_LOAD( filename )

Examples

%=IMG_LOAD( @"c:\\a.jpg")% Loads the image data from the file a.jpg