Automating Imports in FMPA
If you wanted to automate a BaseElements import that runs unattended, you can automate the imports by calling the appropriate script in the BE Data file. Once the solution is opened - by opening the main BE file - you can call a script to run the import automatically.
In the BaseElements_Data file, there is a script called "Event: Import New DDR". You need to call this script with the correct parameters in order to start an import. Parameters for the script are in the form of name value pairs, separated by return characters.
This is useful if you have a large solution with long import times that you want to run regularly for example. You can setup a FMP "Robot" machine and copy your DDR to that machine. When the copy is done, you could use Applescript or a Windows event to automatically import the DDR overnight and have it ready for the next day.
How to use the Auto Import
First, you need to have BaseElements open. So you should open the main BaseElements file and let it run it's opening script. If you're doing this for the first time, it will ask for registration details, so put these in and it will remember them for next time.
Then call a script in the BaseElements_Data file. The script to call is called "Event: Import New DDR". You need to call it with some JSON parameters of the details of the DDR to import. The script paramater is formatted as JSON. An example of the parameters would be :
{
"Client" : "Client Name",
"File" : "/file/path",
"Solution" : "My Solution Name",
"Version" : "Version Number"
}
You can generate this by using the native v17 JSON functions, with :
JSONFormatElements ( JSONSetElement ( "" ;
[ "File" ; "/file/path" ; JSONString ] ;
[ "Solution" ; "My Solution Name" ; JSONString ] ;
[ "Version" ; "Version Number" ; JSONString ] ;
[ "Client" ; "Client Name" ; JSONString ]
) )
You can leave out the JSONFormatElements function call if you prefer, I like it to keep things formatted nicely for readability.
The file paths need to be in the same format that the BaseElements plugin generates. To get an example of the format, use the Data Viewer or a sample file to call the BaseElements plugin function BE_FileSelectDialog. This will put up a dialog asking you to select a file. Choose a suitable file, and the function will return the path to that file. You need to use this path format for the parameters to the plugin.