Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
Preferences.SetValue
Sets preferences value.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
Preferences | 2.7 | ✅ Yes | ✅ Yes | ❌ No | ✅ Yes, on macOS and Windows | ✅ Yes |
Parameters
Parameter | Description | Example | Flags |
---|---|---|---|
Domain | The domain name for your preferences. Leave empty for default one. | "de.mbsplugins.MyApp" | |
Key | The key for the value lookup. | "Username" | |
Value | The new value text. | "Christian" | Optional |
Type | The data type to use. (Mac only) Can be integer, double, boolean or text. |
"text" | Optional |
Result
Returns OK or error message.
Description
Sets preferences value.Domain should be an unique name for your app, like with reverse domain name notation. An example: "de.monkeybreadsoftware.filemaker.runtimes.MyApp". If you use no domain, the default one is used.
Values are stored in registry on Windows and preference files on Mac.
Key must not be an empty string.
This is the location where you can store global settings like the last used username for login.
Changing preferences of FileMaker only works, if you restart FileMaker for changes take effect. Going to the preferences dialog (even with cancel on exit), can cause FileMaker to write it's settings over what you just changed.
To change windows preferences for Windows, you may better go with Registry functions.
Examples
Sets preferences:
MBS( "Preferences.SetValue"; "de.mbsplugins.MyApp"; "Username"; $username )
Set flag to not allow plugins to update:
MBS( "Preferences.SetValue"; "com.filemaker.client.advanced12"; "Preferences:AllowToUpdatePlugins"; 0; "integer")
Set file cache to 1 GB:
MBS( "Preferences.SetValue"; "com.filemaker.client.advanced12"; "Preferences:FileCacheSize"; 1048576; "integer")
Set user name in FileMaker preferences:
MBS( "Preferences.SetValue"; "com.filemaker.client.advanced12"; "Preferences:UserName"; "Chris" )
Set option for custom user name in FileMaker preferences:
Let ( [
// read current options
~currentValue = MBS( "Preferences.GetValue"; ""; "Preferences:AppGenOptions");
// make sure 4th bit is set by setting bit for 8:
~newValue = MBS("Math.BitwiseOR"; ~currentValue; 8)
// and save back value
~result = MBS( "Preferences.SetValue"; ""; "Preferences:AppGenOptions"; ~newValue; "integer")
]; ~result)
Switch off update checks:
Let(
[
oldValue = MBS( "Preferences.GetValue"; "com.filemaker.client.pro12"; "Preferences:AppGenOptions");
newValue = MBS("Math.BitwiseOR"; oldValue; 32 + 32768);
R = MBS( "Preferences.SetValue"; "com.filemaker.client.pro12"; "Preferences:AppGenOptions"; newValue; "integer")
];r )
Set initial file for FileMaker 19 or newer on MacOS:
MBS( "Preferences.SetValue"; "com.filemaker.client.pro12"; "Preferences:UseInitialfile"; 1; "integer") &
MBS( "Preferences.SetValue"; "com.filemaker.client.pro12"; "Preferences:Initialfile"; "filemac:/Mac/Users/cs/Documents/Test.fmp12"; "text")
Enable advanced tools:
MBS( "Preferences.SetValue"; ""; "Preferences:UseAdvancedTools"; 1; "integer" )
Disable advanced tools:
MBS( "Preferences.SetValue"; "com.filemaker.client.pro12"; "Preferences:UseAdvancedTools"; 0; "integer")
See also
- Math.BitwiseOR
- Preferences.DeleteValue
- Preferences.GetValue
- Preferences.GetValueType
- Preferences.HasValue
- Preferences.List
Example Databases
Blog Entries
- Detect and disable advanced database tools
- Set initial file for FileMaker 19 by script
- Whats new in MBS FileMaker Plugin version 9.3
- Comparing Base Elements Plugin to MBS FileMaker Plugin
- MBS FileMaker Plugin, version 6.5pr3
- MBS Filemaker Plugin 2.7 Release notes
- MBS Filemaker Plugin, version 2.7pr2
This function checks for a license.
Created 18th August 2014, last changed 10th February 2024
Preferences.SetTextSelectionWithDragAndDrop - Preview.Available