Skip to main content

TrFile_GetDateLastAccessed (function reference)

By June 1, 2024June 4th, 2024Online Help, Troi File Plug-in
Troi File Plug-in > Functions reference > TrFile_GetDateLastAccessed
Troi File Plug-in for FileMaker Pro

TrFile_GetDateLastAccessed

Returns the date a file was accessed (opened) for the last time.

SyntaxFunction badge

TrFile_GetDateLastAccessed ( switches ; filePath )

Parameters

switches not used, reserved for future use. Leave blank or put "-Unused"
filePath the path to the file for which you want the information

Returned Result

Data type returned

Date

Result

The returned result is the date the file was last accessed. The date is in the same format as a date field.

An error code might also be returned. An error always starts with 2 dollars, followed by the error code. Returned error codes can be:

$$-43 fnfErr File not found, check if the path is valid

Other errors may be returned.

Originated in

Troi File Plug-in 3.5

Compatibility

FileMaker Pro 17 to FileMaker Pro 21 (2024)

Considerations

You can use FileMaker styled paths, like “filewin:/C:/MyFiles/test.txt”.

Example

Set Field [ lastAccessedDate ; TrFile_GetDateLastAccessed ( "-Unused" ;  "C:\Test.txt" ) ]

This may return the number 730172 which is equivalent to the date: 22 Feb. 2000.

Example 2

We assume that in your FileMaker file the following fields are defined:

  lastAccessedDate	date
  gFilePath		Global, text

gFilePath should contain the path to the file, for example “D:\Logs\L2000_01.TXT” (Windows) or “Mac HD:Logs:Log 2000_01” (Mac). In a script add the following script step:

Set Field [ lastAccessedDate ; TrFile_GetDateLastAccessed ( "-Unused" ;  gFilePath ) ]

This will store the date the file, specified by gFilePath, was opened for the last time in the field lastAccessedDate.

Used in example file

Attribute.fmp12

Related functionsFunction badge

TrFile_GetDateModified
TrFile_GetTimestampCreated
TrFile_SelectFileDialog

Related topics

Troi File Plug-in online help (overview)


Online Help Page for Troi File Plug-in for 17 to 2024 –> TrFile_GetDateLastAccessed (filep4291) 2024-0604 19:49:20