Set initial file for FileMaker 19 by script
You can set this by script with MBS FileMaker Plugin by using Preferences.SetValue or Registry.SetValue functions as you see below.
MacOS
For MacOS you can use our Preferences.SetValue function to set the preferences value for "Preferences:UseInitialfile" to 1 to enable or 0 to disable. The preference value "Preferences:Initialfile" uses a Mac specific FileMaker path to the file to open. Here are the two MBS calls to setup a new path:
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")
Windows
For Windows the preferences are stored in the registry, so you need to know the right key. There we set UseInitialfile with 1 or 0 to enable or disable with data type DWORD. The file path to the file is provided as a FileMaker path with filewin: prefix. Here is a sample call:
MBS( "Registry.SetValue"; "HKEY_CURRENT_USER\SOFTWARE\FileMaker\FileMaker Pro\19.0\Preferences"; "UseInitialfile"; 1; "DWORD") &
MBS( "Registry.SetValue"; "HKEY_CURRENT_USER\SOFTWARE\FileMaker\FileMaker Pro\19.0\Preferences"; "Initialfile"; "filewin:/C:/Users/Christian/Desktop/JavaScript.fmp12"; "text")
Automation
To automate installation on dozens of computers, you could do this by script when solution launches to define the file to open for next start. e.g. automatically install FileMaker, send user a welcome email and have them click fmp:// URL. That URL can trigger FileMaker to launch, open a remote database on the server as guest and show a welcome layout. And in a script to setup, you could define what file to open next time. And of course that file could be written to documents folder by script via an Export Field Contents script step. Please only do those steps with user consent!
To remove, you could set UseInitialfile flag to zero. To clear the path, you can use Preferences.DeleteValue and Registry.DeleteValue functions if needed.
Update: This works in FileMaker 18 even as there is no preferences. But it seems to work for us if you set the path.
If you have questions, please do not hesitate to contact us.