TrFile_SetDefaultFileSpec |
Indicates a FilePath (i.e. the file) to be used in succeeding functions where no FilePath is indicated.
Syntax
TrFile_SetDefaultFileSpec ( switches ; filePath )
Parameters
switches | not used, reserved for future use. Leave blank or put "-Unused" |
filePath | the path to the file |
Returned Result
Data type returned
Text
Result
This function does not return anything at the moment. This may change in a future version.
Originated in
Troi File Plug-in 1.0
Compatibility
FileMaker Pro 17 to FileMaker Pro 21 (2024)
Considerations
You can use FileMaker styled paths, like “filewin:/C:/MyFiles/test.txt”.
Example
We assume that in your FileMaker file the following fields are defined:
gErrorCode Global, number
gFilePath Global, text
textField text
gFilePath should contain the path to an existing file, for example “D:\Hello.TXT” (Windows) or “Disk1:Hello” (Mac). TextField contains the text you want to write. In a script add the following scriptsteps:
Set Field [ gErrorCode ; TrFile_SetDefaultFileSpec ( gFilePath ) ]
Set Field [ gErrorCode ; TrFile_SetDefaultCreator ( "ttxt" ) ]
Set Field [ gErrorCode ; TrFile_SetDefaultType ( "TEXT" ) ]
Set Field [ gErrorCode ; TrFile_SetContents ( "-Encoding=ASCII_Windows" ; textField ) ]
This will set the default file to your file with a SimpleText FileType and Creator. Then the text is written to the file.
Used in example file
CreateFile.fmp12
Related functions
TrFile_SetContents |
TrFile_SetDefaultCreator |
TrFile_SetDefaultFileSpec |
Related topics
Troi File Plug-in online help (overview)