Topics
All
MacOS
(Only)
Windows
(Only)
Linux
(Only, Not)
iOS
(Only, Not)
Components
Crossplatform Mac & Win
Server
Client
Old
Deprecated
Guides
Examples
Videos
New in version:
9.5
10.0
10.1
10.2
10.3
10.4
10.5
11.0
11.1
11.2
Statistic
FMM
Blog
Writes a file with the given data.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
Files | 3.5 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameter | Description | Example | Flags |
---|---|---|---|
Data | The data to save. Can be text or container. | "Hello World" | |
FilePath | The native file path. Something like "/Users/cs/desktop/test.txt" on Mac and "C:\Programs\Data\test.txt" on Windows. Files without path end in the root directory on Mac. | "test.txt" | |
filter | Can be base64 to decode text first from base64 encoding. Or can be Hex to decode from hex encoding. | "Base64" | Optional |
Returns "OK" or an error message.
Write file with some text:
MBS("Files.WriteFile"; "Hello World"; $Path )
Write file with some text and decode base64:
MBS("Files.WriteFile"; "SGVsbG8gV29ybGQ="; "/Users/cs/Desktop/test.txt"; "base64")
Write container to temp file and launch:
# get temp folder
Set Variable [$TempFolder; Value:MBS( "Folders.SystemTemporary" )]
# and file name from container
Set Variable [$name; Value:MBS( "Path.LastPathComponent"; test::myContainer )]
# add name to folder path
Set Variable [$TempPath; Value:MBS( "Path.AddPathComponent"; $TempFolder; $name )]
# now write temp file
Set Variable [$r; Value:MBS( "Files.WriteFile"; test::myContainer; $TempPath)]
# and launch file
Set Variable [$r; Value:MBS( "Files.LaunchFile"; $TempPath)]
Write PDF to disk:
Set Variable [$path; Value:MBS( "Path.AddPathComponent"; MBS( "Folders.UserDesktop" ); Invoice::Invoice ID & ".pdf" )]
Set Variable [$r; Value:MBS("Files.WriteFile"; Invoice::PDF Output; $path)]
Write DynaPDF Library to disk and use it:
Set Variable [$path; Value:MBS( "Plugin.Path" )]
Set Variable [$folderpath; Value:MBS( "Path.RemoveLastPathComponent"; $path )]
Set Variable [$libPath; Value:MBS( "Path.AddPathComponent"; $folderpath; "dynapdf.dll" )]
Set Variable [$r; Value:MBS( "Files.WriteFile"; test2::DynaPDFContainer; $libPath )]
Set Variable [$r; Value:MBS( "DynaPDF.Initialize"; $libPath )]
Created 18th August 2014, last changed 6th September 2016
Files.Unmount - Folders.Applications
Feedback: Report problem or ask question.