TrFile_GetTimeLastAccessed |
Returns the time a file was accessed (opened) for the last time.
Syntax
TrFile_GetTimeLastAccessed ( 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
Time
Result
The returned result is the time the file was last accessed. The time is in the same format as a time field (number of seconds since 00:00:00).
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 |
$$-1 | genericErr | The file could not be found (older versions of the plug-in) |
Other errors may be returned.
Originated in
Troi File Plug-in 3.5
Compatibility
FileMaker Pro 17 to FileMaker Pro 21 (2024)
Considerations
On Windows some file systems (FAT) only store the actual Date of the last access. The time in this case will be 00:00:00. See the TrFile_GetDateLastAccessed in this case.
Example
Set Field [ lastAccessedTime ; TrFile_GetTimeLastAccessed ( "-Unused" ; "C:\Test.txt" ) ]
This might return the number 7264 which is equivalent to the time: 02:01:04.
Example 2
We assume that in your FileMaker file the following fields are defined:
lastAccessedTime time
gFilePath Global, text
gFilePath should contain the path to the file for example “D:\Logs\L01.TXT” (Windows) or “Mac HD:Logs:Log 1” (Mac). In a script add the following script step:
Set Field [ lastAccessedTime ; TrFile_GetTimeLastAccessed ( "-Unused" ; gFilePath ) ]
This will store the time the file, specified by gFilePath, was openend for the last time in the field lastAccessedTime.
Used in example file
Attribute.fmp12
Related functions
TrFile_GetTimeModified |
TrFile_SelectFileDialog |
Related topics
Troi File Plug-in online help (overview)