Edit

WriteToTempFile (text [, filename])

Result type:  string (a filesystem path)

Definition:  Creates a new text file in the temp directory and writes the given text to it. Return value is the path to the temp file (filename is automatically generated).

Availability:  MWScript scripts in MoneyWorks Gold v7.1.5 and later

In MoneyWorks 9 and later, you may supply an optional second parameter to specify the name to use. If you do this, the file will be written in the MoneyWorks Automation folder (or the first available safe location specified in the app preferences) instead of the system temp directory. Additionally, you can prefix the specified name with "TMP/" or "CACHE/" to put the file in the temp directory with the given name, or in the cache directory.

Note: On macOS Catalina and later, files written to the system temp directory may not be accessible by other processes, so the cache directory is recommended if you are passing the path to another process for further action.

See Also:

AddSafePath: UI to add a safe path to the preferences

CreateFolder: Create a new folder

File_Close: File functions for creating/reading/writing text files

File_GetLength: File length in bytes

File_GetMark: Get current read/write position

File_Move: Rename/move a file

File_Open: Open a file

File_Path: Get the full path of an open file

File_Read: Read text from current position

File_ReadLine: Read to end of line from current position

File_SetMark: Set Current read/write position

File_Write: Write text at current position